Simple editable grid with document upload field saves OK except for when there are no rows

Hi all,

I have a simple editable grid with a file upload field and a dropdown field.  See screenshot attached.  With this, the interface saves ok and I have my data saved in my rule inputs.  However, then I try to submit the form without any data in grid (no rows), I get this error message - "Could not display interface. Please check definition and inputs.
Interface Definition: Expression evaluation error [evaluation ID = C163B2D3] : An error occurred while executing a save: Expression evaluation error: You must specify a variable to save into, such as ri!name << fn!sum. Received: RQ_Document_Uploads?list."

Any ideas why I am getting this error?  I am also attaching my editable grid SAIL code with this message.

Thanks

a!gridLayout(
  label: "",
  headerCells: {
    a!gridLayoutHeaderCell(label: "File"),
    a!gridLayoutHeaderCell(label: "File Type"),
    a!gridLayoutHeaderCell(label: "")
  },
  columnConfigs: {
    a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 4),
    a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
    a!gridLayoutColumnConfig(width: "ICON")
  },
  rows: {
    a!forEach(
      items: ri!documents,
      expression: a!gridRowLayout(
        contents: {
          a!fileUploadField(
            label: "File Upload",
            labelPosition: "COLLAPSED",
            target: cons!RQ_UPLOADS_FOLDER,
            maxSelections: 1,
            value: fv!item.document,
            saveInto: fv!item.document,
            required: true,
            validations: {}
          ),
          a!dropdownField(
            label: "Dropdown",
            labelPosition: "COLLAPSED",
            placeholderLabel: "--- Select a Value ---",
            choiceLabels: {"Memo", "Invoice", "Product Brochure", "Receipt", "Check/Bank Draft", "Letter", "Other"},
            choiceValues: {"Memo", "Invoice", "Product Brochure", "Receipt", "Check/Bank Draft", "Letter", "Other"},
            value: fv!item.documentType,
            saveInto: fv!item.documentType,
            validations: {}
          ),                                                                                                                                                                                                                                                                                                                                                                                                     

          a!richTextDisplayField(
            value: {
              a!richTextIcon(
                icon: "times",
                link: a!dynamicLink(saveInto: {
                  a!save(ri!documents, remove(ri!documents, fv!index))
                }),
                linkStyle: "STANDALONE",
                color: "NEGATIVE")
            }
          )
        }
      )
    ),
    a!gridRowLayout(
      contents: {
        a!textField(readOnly: true),
        a!textField(readOnly: true),
        a!textField(readOnly: true)
      }
    )
  },
  addRowLink: 
  a!dynamicLink(
    label: if( or(isnull(ri!documents), length(ri!documents)>0),"Add Another Document", "Add New Document"),
    saveInto: {
      a!save(ri!documents, append(ri!documents, {document: "", documentType: null}))
    }
  ),
  rowHeader: 1
)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    A Score Level 1
    in reply to Mike Schmitt

    Thank Mike,

    Here attached is the submit SAIL code.

    a!buttonWidget(
      label: "Approve",
      saveInto: {
        a!save(ri!requestData.status, "Manager Approval"),
        a!save(ri!requestData.currentStage, 2),
        
        /*Save extra data elements in uploaded documents */
        a!forEach(items: ri!documentsOutput,                                                                                                               
          expression: {
            a!save(fv!item.uploader, loggedInUser()),
            a!save(fv!item.uploadDate, today()),
            a!save(fv!item.requestMaster.id, ri!requestData.id)
          }
        ),
        
        /*Save data elements in Process Stage Data Type*/
        a!save(ri!processStageOutputOnly.assignee, loggedInUser()),
        a!save(ri!processStageOutputOnly.stage, "Manager Approval"),
        a!save(ri!processStageOutputOnly.stageNumber, 2),
        a!save(ri!processStageOutputOnly.action, "Manager Approved"),
        a!save(ri!processStageOutputOnly.actionDateTime, now()),
        a!save(ri!processStageOutputOnly.Comment, local!taskComment),
        a!save(ri!processStageOutputOnly.requestMaster.id, ri!requestData.id)
      },
      submit: true,
      style: "PRIMARY",
      disabled: not(local!selectedTab=4),
      validate: true
    )

  • 0
    Certified Lead Developer
    in reply to nanfak

    When and how is `ri!documentsOutput` getting populated?  What is its data type?

  • 0
    A Score Level 1
    in reply to Mike Schmitt

    Here attached is a screenshot of the documentoutput data type.  It is being manually being populated by a user who uploads documents into the file upload field

  • +1
    Certified Lead Developer
    in reply to nanfak

    So i'm not sure I can see what's going on - the Editable Grid rows are being based on members of ri!documents, but then in the Submit button you're looping over ri!documentsOutput - are they actually referring to the same thing?

    Just for sanity's sake, does the issue go away if you comment out the a!forEach statement in the Submit button's save list?  (The one marked "Save extra data elements in uploaded documents")

  • +1
    A Score Level 1
    in reply to Mike Schmitt

    Hi Mike,

    You are right.  I commented about the lines out of the forEach that saves the other fields of the document data type and the error went away.  

    Did I mention that the error only shows up when the interface is called from a process model and that while testing in  the interface designer, this error does not show up.

  • 0
    A Score Level 1
    in reply to nanfak

    Found the problem.  I miss typed the data element name in one of the lines in the for each (a!save(fv!item.requestMaster.id, ri!requestData.id)).  Thanks to your advise, I commented out that section, the code ran, so I further examined that portion of the code and fished out the error.

    Thanks!