Skip to main content
October 26, 2021
Question

castType of boolean and number

  • October 26, 2021
  • 5 replies
  • 0 views

a!localVariables(
  local!chooseValue:1,
  local!buttonChoice,
  a!formLayout(
    label:choose(local!chooseValue,"KONE Maintenanence System","New User Registration System","Update User System","Delete User System"),
    contents:{
      a!radioButtonField(
        label: "Please Choose",
        labelPosition: "COLLAPSED",
        choiceLabels: {"Registration", "Update","Delete"},
        choiceValues: {"Registration", "Update","Delete"},
        value:local!buttonChoice,
        saveInto: {a!save(target:local!buttonChoice,value:save!value),
        if(local!buttonChoice="Registration",
        a!save(target:local!chooseValue,value:2),
        if(local!buttonChoice="Update",
        a!save(target:local!chooseValue,value:3),
        if(local!buttonChoice="Delete",
        a!save(target:local!chooseValue,value:4),
        {}
        )
        )
        ) 
        },
        choiceLayout: "STACKED",
        validations: {}
      ),
      a!imageField(
        label: "Image",
        labelPosition: "COLLAPSED",
        images: {
          a!documentImage(
            document: cons!KONE_IMAGE01
          )
        },
        showWhen:local!chooseValue=1,
        size: "LARGE",
        isThumbnail: false,
        style: "STANDARD"
      ),
      choose(local!chooseValue,{},
      rule!KONE_Development_Insert_Interface(
      backupuseraudit:rule!KONE_Development_backupuseraudit_castType(), 
      userrole:rule!KONE_Development_USER_ROLE_castType(),
      submit:toboolean(),
      ),
      rule!KONE_Development_UserUpdate_Interface(
        userrole:rule!KONE_Development_USER_ROLE_castType(),
        backupuseraudit:rule!KONE_Development_backupuseraudit_castType()),
      rule!KONE_Development_deletefromuserrole_Interface(
        userrole:rule!KONE_Development_USER_ROLE_castType(),
        csetender:rule!KONE_Development_CSE_TENDER_castType(),
        cseservicecatalogue:rule!KONE_Development_CSE_SERVICE_CATALOGUE_castType(),
        pricingaudit:rule!KONE_Development_PRICING_AUDIT_castType(),
        csepriceapprovalphase:rule!KONE_Development_CSE_PRICE_APPROVAL_PHASE_castType(),
        priceapproval:rule!KONE_Development_PRICE_APPROVAL_castType(),
        csetenderphases:rule!KONE_Development_CSE_TENDER_PHASES_castType(),
        cseservicecataloguesubtask:rule!KONE_Development_CSE_SERVICE_CATALOGUE_SUBTASK_castType(),
        cseservicecataloguephases:rule!KONE_Development_CSE_SERVICE_CATALOGUE_PHASE_castType(),
        cseservicecataloguesubtaskphase:rule!KONE_Development_CSE_SERVICE_CATALOGUE_SUBTASK_PHASE_castType(),
        backupuseraudit:rule!KONE_Development_backupuseraudit_castType(),
        backupuserrole:rule!KONE_Development_BACKUP_USER_ROLE_castType(),
        deleteid:tointeger(),
        delete:toboolean(),
        backupuserauditvalid: toboolean(),
        backupuserrolevalid:toboolean(),csetenderphaseslistvalid:toboolean(),
        csepriceapprovalphaselistvalid:toboolean(),pricingauditlistvalid:toboolean(),
        cseservicecataloguephaselistvalid:toboolean(),
        cseservicecataloguesubtasklistvalid:toboolean(),
        cseservicecataloguesubtaskphaselistvalid:toboolean()
      )
      )
    }
  )
)

As title, I am trying to castType for sub-interface rule input saveInto local!variable in order to publish on site, I am trying to cast number and boolean into correct type, but as my code here is incorect,such as submit:toboolean() is incorrect,then how to do it?

    5 replies

    stefanhelzle0001
    Brainy
    October 26, 2021

    I don't get it. Just calling toboolean() will never work because it needs a value that should be turned into a boolean.

    docs.appian.com/.../fnc_conversion_toboolean.html

    October 26, 2021

    of course it is not work, that is what i am asking, not being rude, what is the correct form cast boolean to appropriate type? The code in my rule is similar to as follow,which is work for that parts, but how to transfer boolean and integer to something similar to this? :

    cast(
      'type!{urn:com:appian:types}KONE_Development_CSE_SERVICE_CATALOGUE_SUBTASK_CDT',
      a!queryEntity(
        entity: cons!KONE_Development_CSE_SERVICE_CATALOGUE_SUBTASK_Constant,
        query: a!query(
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: -1
          )
        )
      ).data
    )

    stefanhelzle0001
    Brainy
    October 26, 2021

    I do not understand !

    You want to cast a boolean, and integer (???), into what exactly?

    After you read the documentation and toyed around with the example code in there, what ist your concrete question?