Hi Forum I'd like to display array variables received from a Quer

Hi Forum

I'd like to display array variables received from a Query Database smart service onto a paging grid. I know it is something to do with the todatasubset() function in Appian, but the documentation on in it very confusing and I am struggling to understand how to use it. Does anybody have a tried and tested method for my use case? Any help would be greatly appreciated...

OriginalPostID-101784

OriginalPostID-101784

  Discussion posts and replies are publicly visible

  • Hi Nishanthia, thanks for the quick response

    Unfortunately for my use case I cannot use a query rule, since I am using a query database smart service.

    Basically, I'd like to implement the exact same use case that my colleague posted about a couple days ago - forum.appian.com/.../e-101358 - namely a multi filter search in Appian.

    Please refer to amirula's 1st solution. We are trying to bring through data based on a specific sql query (a query that a standard query rule, to my knowledge, can't handle).

    The query in the smart service node looks like this

    WHERE ( ac!nfrst IS '' OR FirstName like '%' + ac!nfrst + '%' )
    AND ( ac!nlst IS '' OR LastName like '%' + sc!nlst + '%' )
    AND ( ac!njob IS '' OR Job like '%' + sc!njob + '%' )
    etc etc

    So the smart service returns filtered searches into the paging grid based on specific entries that the user filled in for the search.
  • Hi lincoln, try to create a CDT that you will use to bind with the paging grid. The structure of CDT should contain all fields of columns that you would like to display in the grid (I imagine this should also be similar to the columns that you define in your SQL query). Then in query database smart service output, map individual output column to the corresponding fields in the CDT that you just created. Any values that get stored in that CDT should be displayed now in the paging grid.
  • Hi lincoln, try to create a CDT that you will use to bind with the paging grid. The structure of CDT should contain all fields of columns that you would like to display in the grid (I imagine this should also be similar to the columns that you define in your SQL query). Then in query database smart service output, map individual output column to the corresponding fields in the CDT that you just created. Any values that get stored in that CDT should be displayed now in the paging grid.
  • Hi Amirula

    I have created my CDT with the relevant fields to pass through onto my paging grid.

    What I don't understand is how to display this data onto my paging grid. By looking at the paging grid component, there are three main aspects used to enter the data onto the paging grid, namely: the Data Set field, the Data Type field and the column input section.

    Please correct me if I am wrong on the following:

    I'm assuming that in the 'Data Set' field I would enter in the following for my case - todatasubset(cdtExample,data!paginginfo)

    I'm also assuming that in the 'Data Type' field I would enter in the type 'DataSubset' using the picker.

    I am completely lost with actually adding each column for the paging grid in this case. For each column added there are the following options: startindex, batchSize, sort, totalCount, data and identifiers. How do I assign each column?
  • You almost got it. Your expression for your Data Set is correct, but for Data Type you need to select the data type you created for your variable cdtExample and not DataSubset.
  • To add a bit more clarity. In an example I have I am displaying Employee Information for multiple employees. I have a data type called Appian_Employee. In my process I have a multi-valued variable named pv!employeeDetails.

    -My Data Set will be =todatasubset(pv!employeeDetails,data!paginginfo)
    -Data Type is AppianEmployee
  • Thank you very much Michael, sadly this isn't too clear in the documentation but your answer is greatly appreciated!