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.
Hi Everyone,
I am getting the cdt rows through record type using expression rule. Is it possible to add more unique rows to cdt through expression rule. If yes, can anyone please help me out?
Discussion posts and replies are publicly visible
Hello Rahul009
What do you mean by this?
Rahul009 said:I am getting the cdt rows through record type using expression rule.
Are you saying that you are casting the data to RecordType?
Try out the below code. As per my understanding, You are querying data from CDT and casting it to a recordType and using it in a grid. In the same grid you want to edit or add the data and cast the data to CDT and save it using write to datastore entity. If yes, then this is the code.
a!localVariables( local!data: rule!yourQueryOfCDTToRecordData(), local!toCDT: a!forEach( items: local!data, expression: type!CDT( field1:"value", field2:"value", . . fieldn:"value" ) ), { a!gridLayout( label: "Editable Grid", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Header Cell"), a!gridLayoutHeaderCell(label: "Header Cell"), a!gridLayoutHeaderCell(label: "Header Cell"), a!gridLayoutHeaderCell(label: "Header Cell"), a!gridLayoutHeaderCell(label: "Header Cell") }, columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE") }, rows: { a!forEach( items: local!data, expression: { a!gridRowLayout( contents: { a!textField( ), a!textField( ), a!textField( ), a!textField( ), a!textField( ) } ) } ) }, addRowLink: a!dynamicLink( label: "add Row", value: null, saveInto: a!save( local!data, append( local!data, recordType!yourRecordType() ) ) ), selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ), a!buttonArrayLayout( buttons: a!buttonWidget(saveInto: a!save(ri!myCDT, local!toCDT)) ) } )