Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
I need to write below code in a loop :
"<table border=""1"" style=""width:100%""><style>
</style>"& "<tr><td>" & ri!headerList[1] & "</td><td>"& ri!cdtType[2].commentDate&"</td></tr>"&"<tr><td>" & ri!headerList[2] & "</td><td>"& ri!cdtType[1].comment_txt &"</td></tr>" &"</table>",
I want a looping only for
"<tr><td>" & ri!headerList[1] & "</td><td>"& ri!cdtType[2].commentDate &"</td></tr>"
Can anyone let me know please
Discussion posts and replies are publicly visible
You have to create a rule for this in which you can apply looping
a!localVariables( local!data: { 1, 2, 3, 4 }, local!data2: { 1, 2, 3, 4 }, local!data_count: length(local!data2)+1, a!forEach( items: local!data, expression: concat( "<tr><td>" & fv!item & "</td><td> " & local!data2[local!data_count - fv!index] & "</td> </tr>" ) ) )
Thank you so much ujjwal, It was helpfull.
In my case I have a cdt as local!data2 and I want different field name for every row.
1
Cdt.id
2
Cdt.name
3
Cdt.2ndname
In this case, I think you should create your own logic which would be something like this
a!localVariables( local!data: { "Name","Date","Comment"}, local!data2: { a!map( name:"Ujjwal", date:now(), comment:"I want to learn Appian" ), a!map( name:"Ujjwal", date:now(), comment:"I want to learn Appian" ), }, local!data_count: length(local!data2), a!forEach( items: enumerate(local!data_count), /*expression: local!data_count-fv!index*/ expression: concat( "<tr><td>" & local!data[1] & "</td><td> " & index(local!data2,fv!index,"name",{}) & "</td> </tr>"& "<tr><td>" & local!data[2] & "</td><td> " & index(local!data2,fv!index,"Date",{}) & "</td> </tr>"& "<tr><td>" & local!data[3] & "</td><td> " & index(local!data2,fv!index,"Comment",{}) & "</td> </tr>" ) ))
here in line 20 I want again looping, as index value will be passed from rule input
Sorry for the trubble and thanks in advance