Cannot Index type Number (Integer) into type Number (Integer)

Hi All, 

I'm getting the following error after some code changes in my interface: 

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!queryFilter [line 37]: Invalid index: Cannot index type Number (Integer) into type Number (Integer)

I added a new local variable to try and display a RO field that wasn't showing properly - I used the same query logic for this variable as I did for another -- here is the code for the variables: 

load(
  local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1),
  local!studyCoordinator: a!queryEntity(
    entity: cons!CTM_ExternalUsers_DSE,
    query: a!query(
      selection: a!querySelection(
        columns: (a!queryColumn(field: "displayName"))
      ),
      pagingInfo: local!pagingInfo,
      filter: a!queryFilter(
        field: "id",
        operator: "=",
        value: if(isnull(ri!site.studyCoordinator), "None", ri!site.studyCoordinator[1])
        )
      )),
  local!PrincipalInvestigator: a!queryEntity(
    entity: cons!CTM_ExternalUsers_DSE,
    query: a!query(
      selection: a!querySelection(
        columns:(a!queryColumn(field: "displayName"))
      ),
      pagingInfo: local!pagingInfo,
      filter: a!queryFilter(
        field: "id",
        operator: "=",
        value: ri!profile.principalInvestigator[1]
      )
    )),
  local!studyProfileSite: rule!CTM_getStudyProfileSiteBySiteID(ri!site.siteID),
  local!subInvestigator: a!queryEntity(
    entity: cons!CTM_ExternalUsers_DSE,
    query: a!query(
      selection: a!querySelection(
        columns: (a!queryColumn(field: "displayName"))
      ),
      pagingInfo: local!pagingInfo,
      filter: a!queryFilter(
        field: "id",
        operator: "=",
        value: if(isnull(ri!site.subInvestigator), "None", ri!site.subInvestigator[1])
      )
    )
  ),

And the code for the specific field I think it's having issue with -- the value is a number, but I want it to display the name not the number so I used the dot notation. Initially I had an expression rule that took the number value and displayed the name (to avoid using dot notation), but this didn't work either. 

            a!textField(
              label: "Site Investigator",
              labelPosition: "ADJACENT",
              value: local!subInvestigator.data.displayname,
              refreshAfter: "UNFOCUS",
              readonly: true,
              validations: {}
            ),

 

I don't get why it's not able to index a value of the same type? Even when I directly type ri!site.subInvestigator into the "value" of the queryEntity at line 40 it shows nothing even though the value displayed in the test input is the number 56, referring to someone in the External User DSE...

Thanks for any suggestions!

  Discussion posts and replies are publicly visible

Parents
  • Hi Sarah. I think the value in the a!queryFilter() doesn't seem appropriate. Considering that "id" field is a number, you should provide number as its value. But it seems you are passing some text(since you are checking if the value is null, then it as "None" which is text). filter parameter is used to filter the query results that are queried. If you want to display name instead of number, then you should do those manipulations in either in textfield or in the grid field wherever u r planning to do so.

    Also, please check whether you are getting all the values in the ri!site cdt. For testing purpose, you can pass ri!site.subInvestigator to a local variable and pass it as a query filter value.

    I suggest you to check the query receipes provided by Appian

    docs.appian.com/.../Query_Recipes.html
Reply
  • Hi Sarah. I think the value in the a!queryFilter() doesn't seem appropriate. Considering that "id" field is a number, you should provide number as its value. But it seems you are passing some text(since you are checking if the value is null, then it as "None" which is text). filter parameter is used to filter the query results that are queried. If you want to display name instead of number, then you should do those manipulations in either in textfield or in the grid field wherever u r planning to do so.

    Also, please check whether you are getting all the values in the ri!site cdt. For testing purpose, you can pass ri!site.subInvestigator to a local variable and pass it as a query filter value.

    I suggest you to check the query receipes provided by Appian

    docs.appian.com/.../Query_Recipes.html
Children
No Data