When am trying to update the editable grid , the attached code throws an error

When am trying to update the editable grid , the attached code throws an error
Expression evaluation error in rule 'rule': Cannot select without a Value
Any solutions/changes to the code?


Sample Code

OriginalPostID-158041

OriginalPostID-158041

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Can you also share the syntax for rule!CSI_renderCSIStaffingDetails()
  • @Tim,
    Here is the code
    a!gridRowLayout(
    id: ri!index,
    contents: {
    a!textField(
    label:"Req id",
    value: ri!staffingDetails[ri!index].requestIdDetails,
    saveInto: ri!staffingDetails[ri!index].requestIdDetails
    ),
    a!textField(
    label:"ST ID",
    value: ri!staffingDetails[ri!index].standardId,
    saveInto: ri!staffingDetails[ri!index].standardId
    ),
    a!textField(
    label:"SF ID",
    value: ri!staffingDetails[ri!index].staffingId,
    saveInto: ri!staffingDetails[ri!index].staffingId
    )
    }
    )

    @Sonal, i have already gone through that post, but that is not helpful. Iam trying to test that first in interface.
  • @janakik I guess one of the the problems could be (might become in the future) with the definition and usage of local!staffingDetails variable. local!staffingDetails is used in defined in load() and again in with(). So here we can assume that the definition of local!staffingDetails is overridden in with(). So we can conclude that the variable is in scope of with(). And again the same variable (that is in scope of with()) is being used for saving values by passing a reference of it to the rule!CSI_renderCSIStaffingDetails().

    Afaik the SAIL architecture doesn't permit a variable defined in with() for usage in saveInto of a component. Documentation says 'NOTE: Do not save a component's value into a local variable defined by with(). The user's value and the variable's value are overwritten when the expression reevaluates.' (Reference: 'NOTE' Section under https://forum.appian.com/suite/help/7.10/SAIL_Design.html#Enabling_User_Interaction)
  • I tired your code it seems to be working in the test view of interface designer. PFA screen shot for reference.

    TestCode.rtf

  • And just to add to my previous comment, the code only throws an error in case when we start making interactions with the grid (Assuming that there aren't any other errors in the interface), but the interface might load perfectly and continues to render perfectly as long as we don't interact with the component that tries to save the value into a variable defined in scope of with().
  • @Sonal - Yes that works fine in the UI. When i try to update the values in grid i got this error.
    @Sikhivahan - May be that is the reason i have declared a new variable local!newStaffingDetails in load. So my question is how do i save the updated information into a new variable which is null.
    I used this new variable for attribute itemsToken: local!newStaffingDetails in applyComponents. But no luck.
    Any suggestions?
  • As per the documentation local!newStaffingDetails is not intialised in with(), but still i get the same error "Cannot select without a Value".
  • @janaki I would like to suggest to change the way you make query and infact this will help you in increasing performance.

    Please find attached the modified code and here goes my observations and suggestions with regards to your code:

    1. It's better to associate the query with a SAIL component rather than keeping it in with(). The code you place in with() will be evaluated each and every time when you interact with any component (that has saveInto attribute) in the interface. (Anyhow I noticed that you are making use of a button called 'fetch', so I assume that you may want to make query upon clicking the button. Else you can also place it in 'CSI Request ID' text field)

    2. I guess ri!requestID is single valued. I guess its better to check the null value existence as follows: rule!APN_isBlank(ri!requestID). Because APN_isEmpty is generally used for arrays, complex data types or Appian objects such as User, Group etc.

    3. In the attached snippet, you are trying to assign a boolean value to local!staffingDetails when ri!requestID is blank. But in the same interface, you are trying to save complex data type values into it. I agree that local variable has the capacity to save any kind of data and this will be resolved at run time, but still I would like to suggest to save null values into it as you are further making null checks on the same variable. (local!staffingDetails: if(rule!APN_isEmpty(ri!requestID),false,a!queryEntity()))

    4. Finally here is the answer to your question - 'So my question is how do i save the updated information into a new variable which is null': Quiet simple,
    >> if your variable's scope is load, push values into it using saveInto of any component. For instance, if you want to update it upon the interaction with grid, pass the same variable (in addition to the inputs you are already passing) to the rule!CSI_renderCSIStaffingDetails() and make changes in it using saveInto of components in that row.
    >> if your variable's scope is with, push values into it by assigning values to it.
    Example:
    load(
    \tlocal!staffingDetails,
    \twith(
    \ tlocal!newStaffingDetails: local!staffingDetails,
    \ t/*where values are pushed into local!staffingDetails by using 'saveInto' of a button component or components in gridRowLayout etc*/
    \t)
    )

    Still I don't say that the problem will be completely resolved because it further depends on the data types of the inputs, their names and the way you are making calls to the rules. But still, come back with questions if you have any, so that any of the practitioners will respond to them.
  • Thanks for the suggestions.
    I removed 'with' function completely for now, but still i see this error once the fetch button is clicked.

    SailCodeV2.txt