Populate Grid from Process Model

Hello, 

I would like to show an Array of values inside a grid.
These values are stored as Array of CDT inside a Process Model into a variable called Result.

I have created a const Rule of type Process Model with my process model:

Inside my Interface I have:

=load(
local!data: cons!DLF_constGetAllPrototype,
local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: -1, sort: a!sortInfo(field: "name", ascending: true)),
with(
local!datasubset: todatasubset(local!data.result, local!pagingInfo),
a!gridLayout(
label: "Metadati",
totalCount: count(local!data.result),
headerCells: {
a!gridLayoutHeaderCell(label: "Id" )
},
columnConfigs: {
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 )
},
rows: a!forEach(
items: local!data.result,
expression: a!gridRowLayout(
id: fv!index,
contents: {
a!paragraphField(
label: "valore " & fv!item.description,
value: fv!item.description
)
}
)
)
)
)
)

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'todatasubset' parameter 2 [line 5]: Invalid index: Cannot index property 'result' of type Text into type Process Model

I'm very new to Appian and I think I have several errors, but I can't figure out.

Tks

  Discussion posts and replies are publicly visible

Parents
  • Hi Rinaldo

    Ok, I can see the line of thinking you're taking and, yes, there are several mistakes here.

    So: the data you want displayed din the form is being stored into an array that is a process variable in a Process Model. Assuming you know that is working, then you need to pass that data from the process model to your form. So I would expect your form to have a rule input that you can accept that data into the form and then can work with it.

    It looks like you think your constant (of type process model?) can make reference to your process variable. But it can't for the simple reason that the constant is acting as a pointer to a process MODEL and not a process INSTANCE.

    So, back to your process model. I'm second guessing that you're able to start it (as an 'Action' or a 'Related Action') and that there is (my best guess) a Script Task that is deriving the value that you're storing into the process variable 'result'.

    So immediately after this step you'll need to add a 'User Input Task' (which you can think of as a 'container' for a form you want to display); and then you'll need to add your form to this (make sure you've added the 'result' as a rule input to your form and set it to the correct data type and made it an array!)

    When you import the form to your User Input Task Appian will ask you "Do you want to automatically create node inputs to match your interface's inputs? " and you should say 'Yes' to this. This will create a variable in the context of the User Input Task that will be mapped to the rule input of your form (it;s worth noting that a rule input on an interface is NOT a variable! It acts as a reference, or a 'pointer' to a variable which, in this case, is the variable in the User Input Task that Appian has just kindly created for you!)

    Now you need to get the value from your process variable into the variable in the User Input Task, so go to the 'Inputs' tab of your User Input Task and in the 'Value' drop-down pick the process variable that holds your data.

    This should get you to where the form now displays the data you've retrieved in your process.

    Good luck!

  • Thanks, I think I have done all the steps, but now how I can display my Interface?

    I would like to show the grid inside a Site tab.

    Tks

  • As it currently stands you'll have to create a new Tab in your Site, set the type of Tab as an 'Action' and pick the process model you've just built.

    (This is not the only design you could have opted for, depending on overall problem that you're trying to solve...)

  • The best solution could be to call different Interface inside a single interface and show this main Interface into Sites. Do you know how to call and display this process Model inside an Interface?

    Tks

  • The first question I had when I read your initial post (and Is till have this question) was: why are you retrieving the data in a Process Model? You could use the same functionality to retrieve the data directly into a Form, display it in a table and THEN start a Process Model to process the selected case(s)

  • I have to retrieve data from an external service using functions inside a plug-in, the only way I know is to call this function inside a Process Model. In this PM I make a call to the external service end normalize the data into an array of CDT. I'm new to Appian, so I really don't know other ways to do this.

    My final goal is to show inside a grid the data from the external service, from my Front-end experiences I should make a call to the service, take the data end show them inside a grid. Stop :)

Reply
  • I have to retrieve data from an external service using functions inside a plug-in, the only way I know is to call this function inside a Process Model. In this PM I make a call to the external service end normalize the data into an array of CDT. I'm new to Appian, so I really don't know other ways to do this.

    My final goal is to show inside a grid the data from the external service, from my Front-end experiences I should make a call to the service, take the data end show them inside a grid. Stop :)

Children
  • Ok.

    1. Let's check that you can ONLY call the "plug-in" from a process model. What is the plug-in? I presume there's an entry for it in the AppMarket on Appian Community?
    2. Even if you can only call it in a PM you can still start the PM from a Site. You'll need to add a 'Start Form' to your PM so you can select it as the 'Action' in your Site (so you'll need to create form and set it as the Start Form of your PM). For the moment it can just contain a 'Submit' button and nothing else. Assuming you want a synchronous experience for your end-users you'll have to chain the process model so that the User Input Task that will display your data will be presented immediately after the User has hit 'Submit' on the Start Form (if it;s not chained the User Input Task will result in a Task in the Task List i.e an asynchronous experience)