Skip to main content
Known Participant
Nov 25, 2022 1:15 PM UTC
Question

Editable grid using a!multipleDropdownField(), when user selects the two values in multiple dropdown field then it is storing in CDT ri!rules[fv!index].clientID like (clientID 1234; 7890)

Hi All,

In Editable grid using a!multipleDropdownField(), when user selects the two values in multiple dropdown field then it is storing in CDT ri!rules[fv!index].clientID  like (clientID 1234; 7890)

a!save(
ri!rules[fv!index].clientID,
fv!item.clientID
) 

Here, for each selected clientID, how to build same CDT with second selected clientID.

Sample code is pasted for a!multipleDropdownField() which is used in Editable grid

Requirement is for each selected clientID in multiple dropdown, on click on button need to display in another editable grid for two selected clientID in separate two rows.

 a!multipleDropdownField(
   label: "clientID",
   placeholder: "Type in Client Name/clientID",
   choiceLabels: if(
     rule!APN_isEmpty(ri!clientDetails),
     {},
     append(a!forEach(
       items: ri!clientDetails,
       expression: index(fv!item, "custname", {}) & " - " & index(fv!item, "clientID", {})
     ),"NONE")
   ),
   choiceValues: append(if(
     rule!APN_isEmpty(ri!clientDetails),
     {},
     index(ri!clientDetails, "clientID", {})
   ),"NONE"),
   value: if(length(trim(split(fv!item.clientID,";")))>1,trim(split(fv!item.clientID,";")),fv!item.clientID),
   saveInto: {
     fv!item.clientID,
     /*a!save(fv!item.clientID,split(fv!item.clientID,";"))*/
     /*,*/


     a!save(
       ri!rules,
       if(
         rule!APN_isEmpty(ri!rules),
         local!rulesGrid,
         ri!rules
       )
     ),
     a!save(
       ri!rules[fv!index].clientID,
       fv!item.clientID
     ),
     a!save(
       ri!selectedObligorsId,
       ri!rules[fv!index].clientID
     )
   },
   searchDisplay: "ON",
   required: true,
   requiredMessage: "Value is required",
   validations: {},

 )

Regards,
Sandeep

    5 replies

    New Participant
    Nov 25, 2022 4:21 PM UTC

    Hi,

    You can use save!value

    a!save(
    fv!item.clientID,
    tostring(save!value)
    )

    Known Participant
    Nov 25, 2022 4:41 PM UTC

    Hi Vinay, Thank you.

    Actually i am looking for some sample code, when two dropdown values selected from the a!multipledropdown() in an Editable grid instead of storing two values in CDT ri!rules.clientID like:

    [1]

    id: null
    name: [Test]
    clientID: [1234; 7890]

    [2]

    id: null
    name: [ABC]

    clientID: null

    whether it is possible to store like this:

    [1]

    id: null
    name: [Test]
    clientID: [1234]

    [1]

    id: null
    name: [Test]
    clientID:[7890]

    [2]

    id: null
    name: [ABC]
    clientID: null

    davel001150
    Inspiring
    Nov 28, 2022 2:52 PM UTC

    You'll have to do some additional logic on your own.  Maybe save first to a local variable as intermediate step.  Then on submit, a!forEach intermediate step, a!forEach fv!item.clientID, saveInto finalState type!CDT(fill it with copy of parent fields and fv!item for clientID)