Hi guys,
I think I am close to the solution, but I've been stuck with this for a while and figured asking cannot hurt.
I am creating an interface which is supposed to show the user data from another User Input Task and have them confirm it has been input correctly. For this I use a read-only grid which I configured according to the Appian tutorial. However, it displays the data in only one row, albeit separated in the pre-defined columns (so e.g. it will say for Underlying "Underlying1; Underlying 2" in one cell).
The data is pulled from a CDT as a rule input. It contains "flat" data like single booleans, but also arrays. For this exercise, only arrays are concerned. Do I have to manipulate the data beforehand or am I missing something major?
My code:
a!gridField( label: "Fixing Levels", labelPosition: "JUSTIFIED", data: ri!product_cdt, columns: { a!gridColumn( label: "Underlying", value: fv!row.underlying, align: "START", width: "AUTO" ), a!gridColumn( label: "Fixing Date", value: fv!row.fixingDate, align: "START", width: "AUTO" ), a!gridColumn( label: "Fixing Type", value: fv!row.fixingType, align: "START", width: "AUTO" ), a!gridColumn( label: "Fixing Level", value: fv!row.fixingLevel, align: "START", width: "AUTO" ), a!gridColumn( label: "Fixing Factor", value: fv!row.fixingFactor, align: "START", width: "AUTO" ) }
Discussion posts and replies are publicly visible
Can you check if your rule input is declared as multiple ?
and, can you also provide your testing values for this rule input ?
I tested like this and used the local as the data source for the grid:
local!data: { fixingDate: {"28/02/2022", "28/02/2022"}, fixingFactor: {1, 1}, fixingType: {3, 3}, fixingLevel: {1, 1}, underlying: {"Test", "Test"} },
The concerned variables in the CDT are set to multiple
Hi Matthias,
Instead of making the variables in the CDT as multiple, why dont you make them single and use your CDT as a multiple variable, so that your data can look like the below:
local!data: { { fixingDate: "28/02/2022", fixingFactor: 1, fixingType: 3, fixingLevel: 1, underlying: "Test" }, { fixingDate: "28/02/2022", fixingFactor: 1, fixingType: 3, fixingLevel: 1, underlying: "Test" } }
Note that the grid will be making rows based on the count of your product_cdt and not what it's internal structure is.
Oh, I understand! Problem is that the CDT is already used in many other instances, so I cannot change the CDT. I can however change the way I use the local, so thanks for the tip!
Quick follow-up.. what would you advise in order to go from {"test","test"} to {"test"}, {"test"} ? Apparently neither count nor len work for variables with multiple in it..
You could use something like this. Use index in case different columns of your cdt may not have same lengthlocal!data: { fixingDate: { "28/02/2022", "29/02/2022" }, fixingFactor: { 1, 1 }, fixingType: { 3, 3 }, fixingLevel: { 1, 1 }, underlying: { "Test", "Test" } }, local!gridData: a!forEach( items: enumerate( count(cast(typeof({}), local!data.fixingDate)) ), expression: { fixingDate: local!data.fixingDate[fv!index], fixingFactor: local!data.fixingFactor[fv!index], fixingType: local!data.fixingType[fv!index], fixingLevel: local!data.fixingLevel[fv!index], underlying: local!data.underlying[fv!index] } )
Wonderful! My thanks to you, this works perfectly for my case!