Hi all,I am trying to show data in an editable grid where they can edit data and save it to back to database. While trying to display, I am getting the following error
This is how the data is present in database
I tried using split function but it didnt resolve the issue. Can someone tell what I am missing here . I have attached the code
a!localVariables( local!data: /*Query*/, local!dropdown: { "A", "B", "C", "D"}, a!gridLayout( label: "Editable Grid", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Platform") }, columnConfigs: {}, rows: { a!forEach( items: local!data, expression: a!gridRowLayout( contents: a!multipleDropdownField( label: "Platform", choiceLabels: local!dropdown, choiceValues: local!dropdown, value: fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}record.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'], saveinto:fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}record.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'] ) ) ) }, selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ) )
Discussion posts and replies are publicly visible
How did you use the split() function?
A small working example:
a!localVariables( local!value, a!multipleDropdownField( choiceLabels: {"A", "B", "C"}, choiceValues: {"A", "B", "C"}, value: if( a!isNullOrEmpty(local!value), null, split(local!value, ";") ), saveInto: a!save( target: local!value, value: joinarray(save!value, ";") ) ) )
Hi ,
The backend sent "A; B" as one string, so we have split it. Please refer to this code.
a!localVariables( local!data: rule!TA_QRY_UserAccess(), local!dropdown: { "A", "B", "C", "D"}, a!gridLayout( label: "Editable Grid", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Platform") }, columnConfigs: {}, rows: { a!forEach( items: local!data, expression: a!gridRowLayout( contents: a!multipleDropdownField( label: "Platform", choiceLabels: local!dropdown, choiceValues: local!dropdown, value: split(fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}TA Users Access.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'],"; ",{}), saveinto:fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}TA Users Access.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'] ) ) ) }, selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ) )
I tried using the split function in value field like split(fv!item,";")did the same for choicelables and choice values as well, but it didnt resolve the issue
Thanks Naina Kumari . The error got resolved. I can see that for split() function you have used "; " as separator instead of ";". Like you have added extra space after semi colon for separation. Is it given because values are having one extra space after semi colon??
yes it was , but as Stefan Helzle suggested the best way to do this, so you need to use always best practice.
Yeah I did some change. Instead of using "; " , I used ";" separator followed by trim function. It solved the issueThanks for the hint on the spacing Naina Kumari
Just an update. I tried the split function with ";" and followed it with a trim function. It solved the issue. The extra spacing hinted by Naina Kumari which comes after the semicolon separator has caused this issue.
a!multipleDropdownField( label: "Platform", choiceLabels: local!dropdown, choiceValues: local!dropdown, value: trim(split(fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}TA Users Access.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'],";")), saveinto:fv!item['recordType!{a3bb3bf8-8475-4d37-8cdd-f8db72114a55}TA Users Access.fields.{a4be7f3b-9f4c-4101-8518-99a99631768e}platform'] )
When I store multiple values to a single field, I want to have exact control on what is going on. By default, Appian concatenates values with a "; " separator. My code snippet changes that to just ";".
And then, you don't need trim() to fix a problem, that you could avoid in the first place.
Yeah I tried it now. Joining the array using ";" does not allow spaces to get added additionally.Thanks Stefan Helzle for the info.