#SAIL Hello ! I'm trying some SAIL tutorials, but one

#SAIL

Hello !

I'm trying some SAIL tutorials, but one of them is not working. It's the following:
forum.appian.com/.../SAIL_Recipes

I really need this, since SAIL Forms doesn't have the grid component as we have on Portal Forms.

Trying as a test rule, the following error appears:
"[Lorg.json.JSONObject; cannot be cast to [Lcom.appiancorp.suiteapi.process.TypedVariable;"

And trying as a process model:
"Erro de avaliação de expressão in rule 'multipletextcomponents': Error evaluating function fn!apply :
Expression evaluation error in rule 'ucdynamicfieldeach' (called by rule '27917') at function a!textField:
Invalid index (1) for list: valid range is empty"

I did everything the Recipe said, but unfortunatetly couldn't get it to work. So if someone already tried
it with success, please let me know what am I doing wrong.

Thanks...

OriginalPostID-99840

OriginalPostID-99840

  Discussion posts and replies are publicly visible

  • How far did you get into the tutorial? Are you only trying to test the expression? If so, please ensure that you have your rules defined correctly.
    rule!ucDynamicFieldsUpdateArray has 3 inputs, and rule!ucDynamicFieldEach has 2 inputs.
  • Hello, Patty ! As I said above, I tried testing the expression. and also through a process model (both display an error). Yes, I created the required inputs, as described in the recipe. I checked the steps many times and couldn't see where is my mistake.
  • Can you copy each of your rules and expressions?
  • Patty, here they are:

    ucDynamicFieldsUpdateArray:

    =with(
    local!newGuestList: updatearray(ri!guests, ri!index, ri!newValue),
    if(isnull(local!newGuestList[count(local!newGuestList)]),
    local!newGuestList,
    append(local!newGuestList, "")
    )
    )

    ucDynamicFieldEach:

    =a!textField(
    label: if(ri!index=1, "Guest Names", ""),
    refreshAfter: "KEYPRESS",
    value: ri!guests[ri!index],
    saveInto: ri!guests << rule!ucDynamicFieldsUpdateArray(ri!index, ri!guests, _)
    )

    multipleTextComponents:

    =a!formLayout(
    label:"SAIL Example: Add Text Components Dynamically",
    firstColumnContents: {
    /* The guests array is passed to the rule directly, creating a partial function */
    a!applyComponents(
    function: rule!ucDynamicFieldEach(index: _, guests: ri!guests),
    array: 1+enumerate(count(ri!guests))
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(label: "Submit")
    )
    )
  • It looks like your expression for "multipleTextComponents:" is missing the load function:
    =load(
    local!guests: {""},
    a!formLayout(
    label:"SAIL Example: Add Text Components Dynamically",
    firstColumnContents: {
    /* The guests array is passed to the rule directly, creating a partial function */
    a!applyComponents(
    function: rule!ucDynamicFieldEach(index: _, guests: local!guests),
    array: 1+enumerate(count(local!guests))
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(label: "Submit")
    )
    )
    )
  • Yes, but it's on purpose. As I couldn't get it to work as a rule, I created a process model to test it. And followed the steps of the recipe
    (To write your data to process
    1.Create rule input: guests (Text Array)
    2.Remove the load() function
    3.Delete local variable: local!guests
    4.In your expression, replace: local!guests with ri!guests
    5.In your process model, create variables: guests (Text Array) with no value

    On a start form, create process parameters

    6.In your process model, update your SAIL Form definition with:

    On a start form: =rule!sailRecipe(guests: pv!guests) )
  • Patty, thanks a lot !

    I did the change you suggested and the rule is now working, but I can't save the multiple inputs into a process variable.

    Do you know what may be the problem ?

    I created a text array input and a text array process variable to save it.

    Thanks in advance.