Problem in "Interfaces Tutorial 103"... with a type

hi,

I have a littel problem with the online Course  "Interfaces 103: Build Dynamic Interfaces", "Part3 : Creating an editable grid" at "54 sec" in the video.

The tutor shows at this point how to add a row to the editable grid by using the addRowLink property and a a!dynamicLink() function in conjunction with a!saveInto() function.
He then saves into his rule input ri!Items the value :  append( ri!items, {local!newGridRow}).

local!newGridRow was constucted by him as a local variable by using a type constructor like: local!newGridRow: 'type!{urn:com:appian:types}EPR_items'().

I assume this leads to a constructed but empty dataStructure where all values of the variables in the CDT items are 'null', wether they are of type number, decimal, or boolean and "" when text.

At least that happens with the CDT "departments" which I use when I try to adapt the example .

My local!newGridRow Variable looks like this:

department

    • departmentid null(Number (Integer))
      • name ""(Text)
        • order null(Number (Integer))
          • isactive null(Boolean)

          The tutor uses a dropdown field in his example on the text field 'category'.

          Appending the new row local!newGridRow into his r!items list works, because inserting a "" into a list of text at position category in the CDT items is possible and therefore the dropdown field is consistent afterwards with text values in his choiceLabels and choiceValues list.

          Now my question:

          In my case I decided to use the 'order" field in the dropdown field, which is an integer.

          When I use the same statement to append the new row to the list I receive the following error message:

          "Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 47]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!dropdownField [line 72]: A dropdown component [label=“Dropdown”] has an invalid value for “choiceValues”. Choice values cannot be null."

          I guess the reason for this error is that after constructing the local variable local!newGridRow the value of the order property is "null", which in turn appending to the depatments (aka items) list results in a null in an integer field.

          And the dropdown field crashes, because it cannot compute a null value in a dropdown field, which is exactly what the error message states.

          But what can I do about it?

          I expected the dropdownfield to show the "Please selcect a value" message in case the value for this field is not set or null.
          How can I force appian to create the type with a default value "0" at the order property or how can I prevent the dropdown field from crashing???

          (Hint: in my variant I tried to use a dynamic generated list of  choices and values because it is the field 'order' and I thought it might be a good usecase to use the dropdownfield to manually bring my departments in a order, which urges me to add max(order+1) as the new 'order' list entry for a new row later. but I did not reach that point....)

          thanks for your advice.

            Discussion posts and replies are publicly visible