Castinvalid error(Could not cast from Number (Integer) to MY CDT.

Hello

How to convert integer value to CDT data type.
I am getting cast invalid error when I am trying to store a value in my cdt field from rule input.
I try two pattern .(plz check below of screenshot)
pattern ①:integer value of rule input


pattern ②: integer array value of rule input.


Please help me to explain why this error occur and how to resolve it .

Thanks a lot

  Discussion posts and replies are publicly visible

Parents
  • You cannot cast a Number/Integer (a single value) to your CDT (which contains 3 mapped key-value pairs). Invalid conversion. Appian Docs has a section about Casting; can also look at Appian Functions under Quick Links (top navigation bar).

    You cannot convert the integer value to a CDT, but you can map the value to a field in the CDT (like the 'id' field). Example below. When you do it, you would want to type in: type!RB_Test. It should pop up with autofill that looks closer to below. When you put the cursor inside the parenthesis at the end of it, on the bottom left of that screen, it will show you the keys for that CDT.

    'type!{urn:com:appian:types:RB}RB_Test'( id: ri!integer )     =>     TEST RULE     =>     RB_Test{ id: 100, name: null, memo: null }

Reply
  • You cannot cast a Number/Integer (a single value) to your CDT (which contains 3 mapped key-value pairs). Invalid conversion. Appian Docs has a section about Casting; can also look at Appian Functions under Quick Links (top navigation bar).

    You cannot convert the integer value to a CDT, but you can map the value to a field in the CDT (like the 'id' field). Example below. When you do it, you would want to type in: type!RB_Test. It should pop up with autofill that looks closer to below. When you put the cursor inside the parenthesis at the end of it, on the bottom left of that screen, it will show you the keys for that CDT.

    'type!{urn:com:appian:types:RB}RB_Test'( id: ri!integer )     =>     TEST RULE     =>     RB_Test{ id: 100, name: null, memo: null }

Children