Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
2 replies
Subscribers
7 subscribers
Views
1543 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
#SAIL Hi there, I'm having trouble to print some data
michelb
over 11 years ago
#SAIL
Hi there,
I'm having trouble to print some data on a Grid.
We are using the following structure on a CDT (which is also a database on MySQL):
CDT1
CDT2 (multiple)
field1
field2
field3
When I use a rule to filter my CDT1 and find the CDT2 objects which correspond to it,
I cannot print the field1, field2 and field3, because an error appears saying
they're not list type.
I understanded that the grid text column just prints an array, and my array is the
CDT2, not the fields inside of it. I want to know how can I print the fields on the Grid,
putting them inside an array. Is there some way to do this ?
I have a foreign key of my CDT1 inside my CDT2, but it cannot be used with Appian Query Rules.
Here's a practical example of what I'm trying to do:
a!gridTextColumn(
label: "Field1",
data: index(
local!datasubset.data.cdt2,
"cdt2.field1",
{}
),
field: "field1"
)
Thanks !
...
OriginalPostID-99711
OriginalPostID-99711
Discussion posts and replies are publicly visible
Parents
0
bend
over 11 years ago
If I understand your requirements, here is how I would handle it:
1. Create a rule to create your form/report/dashboard/section, I will use a dashboard for this example.
=rule!APN_uiRecordDashboardOneColumn(
load(
CDT1: rule!returnCDT1(pkId),
CDT2: tr[1].CDT2,
pageInfo: rule!APN_pagingInfo(
startIndex: 1,
batchSize: -1,
sort: {field: "someFieldInCDT2", ascending: false}
),
repPageInfo: rule!APN_generateRepeatedValueForArrayLength(CDT2,pageInfo),
repEmpty: rule!APN_generateRepeatedValueForArrayLength(CDT2,""),
apply(rule!generateCDT2Grid,merge(CDT2,repPageInfo,repEmpty))
)/*End Load*/
)
The first variable 'CDT1' calls a query and returns cdt1.
The second variable 'CDT2' retrieves all of the CDT2's found in CDT1.
the other variables I created are just to pass to my second rule which will generate a grid to display the contents of CDT2.
The apply statement loops over all of my CDT2's and returns a grid for each CDT2.
Here is the rule I loop over in the apply() statement:
ruleName is generateCDT2Grid with inputs of CDT2 type=Any, value type=Any, saveInto type=Any
=rule!APN_uiSectionOneColumn(
label:CDT2.title,
contents:{if(rule!APN_arrayLength(CDT2)=0,
rule!APN_uiTextReadOnly(label:"",
instructions:"",
value:"No Records to Display.",
hideWhenNull:true(),
alternateText:""),
rule!APN_uiGrid(
label:"" ,
instructions:"",
columns: { rule!APN_uiGridTextColumn("Coumnn1","CDT2FieldName1",CDT2.column1,"LEFT"),
rule!APN_uiGridTextColumn("Coumnn2","CDT2FieldName2",CDT2.column2,"LEFT"),
rule!APN_uiGridTextColumn("Coumnn3","CDT2FieldName3",CDT2.column3,"LEFT")
},
value: rule!APN_pagingInfoAll(),
saveInto: ri!saveInto,
totalCount: length(CDT2)
)
)},
hideWhenEmpty: true()
)
This should generate what you are looking for if I understand your requirements correctly.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
bend
over 11 years ago
If I understand your requirements, here is how I would handle it:
1. Create a rule to create your form/report/dashboard/section, I will use a dashboard for this example.
=rule!APN_uiRecordDashboardOneColumn(
load(
CDT1: rule!returnCDT1(pkId),
CDT2: tr[1].CDT2,
pageInfo: rule!APN_pagingInfo(
startIndex: 1,
batchSize: -1,
sort: {field: "someFieldInCDT2", ascending: false}
),
repPageInfo: rule!APN_generateRepeatedValueForArrayLength(CDT2,pageInfo),
repEmpty: rule!APN_generateRepeatedValueForArrayLength(CDT2,""),
apply(rule!generateCDT2Grid,merge(CDT2,repPageInfo,repEmpty))
)/*End Load*/
)
The first variable 'CDT1' calls a query and returns cdt1.
The second variable 'CDT2' retrieves all of the CDT2's found in CDT1.
the other variables I created are just to pass to my second rule which will generate a grid to display the contents of CDT2.
The apply statement loops over all of my CDT2's and returns a grid for each CDT2.
Here is the rule I loop over in the apply() statement:
ruleName is generateCDT2Grid with inputs of CDT2 type=Any, value type=Any, saveInto type=Any
=rule!APN_uiSectionOneColumn(
label:CDT2.title,
contents:{if(rule!APN_arrayLength(CDT2)=0,
rule!APN_uiTextReadOnly(label:"",
instructions:"",
value:"No Records to Display.",
hideWhenNull:true(),
alternateText:""),
rule!APN_uiGrid(
label:"" ,
instructions:"",
columns: { rule!APN_uiGridTextColumn("Coumnn1","CDT2FieldName1",CDT2.column1,"LEFT"),
rule!APN_uiGridTextColumn("Coumnn2","CDT2FieldName2",CDT2.column2,"LEFT"),
rule!APN_uiGridTextColumn("Coumnn3","CDT2FieldName3",CDT2.column3,"LEFT")
},
value: rule!APN_pagingInfoAll(),
saveInto: ri!saveInto,
totalCount: length(CDT2)
)
)},
hideWhenEmpty: true()
)
This should generate what you are looking for if I understand your requirements correctly.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data