how to save the updated values of rule input into the particular CDT fields

Please suggest me,

how to save the updated values of rule input into the particular CDT fields eg: I have multiple lists like list1 and list2....... in one interface if I update list1 it should save that list in that CDT. for each list, I have a separate primary key.

ex:list1-30

list2-31 if i update 30 it should save the values into that key of that CDT

  Discussion posts and replies are publicly visible

Parents
  • Generally, wherever you are utilizing saveInto to update the lists, you can also use a!save() to update the CDT.  Can you provide any sample code of what you are attempting etc?

  • a!localVariables(
    local!item:'type!{urn:com:appian:types:SHA}SHA_newList'(),
    local!propertyTypeList:rule!SHA_quertyTogetThePropertyTypeName(),
    local!ammenityTypeList:rule!SHA_quertyTogetTheAmmenityType(),
    local!mappingKey: {1},
    local!Doc:'type!{urn:com:appian:types:SHA}SHA_document'(),

    {
    a!sectionLayout(
    label:"",
    contents:{
    a!richTextDisplayField(
    label:"",
    value: a!richTextItem(
    text:"Add Listing ",
    size:"LARGE",
    style:"STRONG"
    )
    )
    },
    divider:"BELOW"
    ),
    a!sectionLayout(
    label:"",
    contents: {
    a!richTextDisplayField(
    labelPosition:"COLLAPSED",
    value: {
    a!richTextItem(
    text: {
    a!richTextIcon(icon:"industry"),
    "Listing"
    },
    color:"STANDARD",
    size:"MEDIUM_PLUS",
    style:"STRONG"
    )
    })},
    divider:"BELOW"
    ),
    a!forEach(
    items:if(
    or(ri!isReadOnly,ri!isEditable),
    ri!listing,
    local!item
    ),
    expression:
    a!localVariables(
    local!ammenities,
    local!document,
    local!mappingId:index(local!mappingKey,fv!index,null),
    a!boxLayout(
    label:"Listing" & fv!index,
    contents: {
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!dropdownField(
    label:"Property Type",
    placeholder:"select a type",
    choiceLabels:index(local!propertyTypeList,"propertyTypeNm",null),
    choiceValues:index(local!propertyTypeList,"propertyTypeId",null),
    value:fv!item.propertyTypeIdFk,
    saveInto:{
    a!save(fv!item.mappingKey,local!mappingId),
    fv!item.propertyTypeIdFk

    },
    required:true,
    disabled: ri!isReadOnly=true()
    )
    ),
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Name",
    placeholder:"enter the Name",
    value:fv!item.propertyName,
    saveInto:fv!item.propertyName,
    readOnly:ri!isReadOnly
    )

    )}),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Description",
    placeholder: "enter the description",
    value:fv!item.propertyDescription,
    saveInto:fv!item.propertyDescription,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Address",
    value:fv!item.propertyAddress,
    saveInto:fv!item.propertyAddress,
    readOnly:ri!isReadOnly
    )

    )

    }),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!textField(
    label:"Floor PlaneName",
    value:fv!item.floorPlanName,
    saveInto:fv!item.floorPlanName,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:a!textField(
    label:"Neighborhood",
    value:fv!item.neighborhood,
    saveInto:fv!item.neighborhood,
    readOnly:ri!isReadOnly
    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:a!textField(
    label:"Price",
    value:fv!item.price,
    saveInto:fv!item.price,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:a!textField(
    label:"Square FootAge",
    value:fv!item.squareFootage,
    saveInto:fv!item.squareFootage,
    readOnly:ri!isReadOnly
    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!dropdownField(
    label:"Bed Rooms",
    placeholder:"select a value",
    choiceLabels:cons!SHA_BEDROOMLIST,
    choiceValues:cons!SHA_BEDROOMLIST,
    value:fv!item.bedRooms,
    saveInto:fv!item.bedRooms,
    disabled:ri!isReadOnly


    )
    ),
    a!sideBySideItem(
    item:a!dropdownField(
    label:"Bath Rooms",
    placeholder:"select a value",
    choiceLabels:cons!SHA_BEDROOMLIST,
    choiceValues:cons!SHA_BEDROOMLIST,
    value:fv!item.bathRooms,
    saveInto:fv!item.bathRooms,
    disabled:ri!isReadOnly

    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:a!dropdownField(
    label:"Pets",
    placeholder:"select a value",
    choiceLabels:{"Cat","Dogs","Kangoors","Rabbits","Tortoise","none"},
    choiceValues:{"Cat","Dogs","Kangoors","Rabbits","Tortoise","none"},
    value:fv!item.pets,
    saveInto:fv!item.pets,
    disabled:ri!isReadOnly

    )
    ),
    a!sideBySideItem(
    item:
    a!radioButtonField(
    label:"Double Occupancy",
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:fv!item.doubleOccupancy,
    saveInto:fv!item.doubleOccupancy,
    disabled:ri!isReadOnly


    )
    )


    }),
    a!multipleDropdownField(
    label: "Ammenities",
    placeholder: "chooose",
    choiceLabels: index(local!ammenityTypeList,"ammenityTypeNm",null),
    choiceValues: index(local!ammenityTypeList,"ammenityTypeId",null),
    value:
    if(
    or(ri!isReadOnly,ri!isEditable),
    ri!ammenities.ammenityTypeIdFk,
    local!ammenities
    ),
    saveInto: {
    local!ammenities,
    a!save(
    ri!ammenities,
    a!forEach(
    items:local!ammenities,
    expression: 'type!{urn:com:appian:types:SHA}SHA_newAmmenities'(
    ammenityTypeIdFk: fv!item,
    mappingKey: local!mappingId
    )
    )
    )
    },
    disabled: ri!isReadOnly
    ),
    a!sectionLayout(
    label:"",
    contents: {
    a!richTextDisplayField(
    labelPosition:"COLLAPSED",
    value:{
    a!richTextIcon(
    icon:"file-text",
    color:"ACCENT",
    size:"LARGE"
    ),
    a!richTextItem(
    text:"Document",
    color:"SECONDARY",
    size:"LARGE",
    style:"STRONG"
    )
    }
    )
    },
    divider:"BELOW"
    ),
    a!gridLayout(
    label:"",
    headerCells:{
    a!gridLayoutHeaderCell(label:"Upload"),
    a!gridLayoutHeaderCell(label:"DocDescription"),
    a!gridLayoutHeaderCell(label:" ", align: "LEFT")
    },
    columnConfigs:{},
    rows:{
    a!forEach(
    items:
    if(
    or(ri!isReadOnly,ri!isEditable),
    ri!Document,
    ri!Document),
    expression:a!gridRowLayout(
    contents:{
    a!fileUploadField(
    label:"Upload Document",
    target:cons!SHA_FOLDER,
    maxSelections:1,
    value:fv!item.appianDocId,
    saveInto: fv!item.appianDocId,
    required: true(),
    requiredMessage:"Please upload document",
    disabled:{ri!isReadOnly}
    ),
    a!textField(
    label:"docdescription",
    placeholder:"enter doc description",
    value:fv!item.docDescription,
    saveInto:fv!item.docDescription,
    required: true(),
    readOnly:ri!isReadOnly

    ),
    a!richTextDisplayField(
    label: "Rich Text",
    labelPosition: "COLLAPSED",
    value: {a!richTextIcon(
    icon: "TIMES",
    link: a!dynamicLink(
    saveInto: a!save(ri!Document,remove(ri!Document,fv!index)),
    showWhen:or(ri!isEditable,ri!isReadOnly=false()),

    ),
    color:"NEGATIVE"
    )}
    )

    }
    )
    )
    },
    selectionValue:ri!Document,
    selectionSaveInto:ri!Document,
    selectable: {},
    selectionRequired:false,
    selectionDisabled:{},
    addRowLink:a!dynamicLink(
    label: "Upload New File",
    value:true(),
    saveInto:{
    a!save(ri!Document,append(ri!Document,{ local!Doc})),
    a!save(
    ri!Document.mappingKey,tointeger(local!mappingId)
    )
    },
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false())

    ),
    validations: {},
    shadeAlternateRows:true

    )
    })
    )),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "ADD ANOTHER LIST",
    icon: "plus-circle",
    value:
    if(or(ri!isEditable,ri!buttons),
    ri!listing,
    local!item),
    saveInto:{
    a!save(
    local!item,
    append(local!item,'type!{urn:com:appian:types:SHA}SHA_newList'())
    ),
    a!save(
    local!Doc,
    append(local!Doc,'type!{urn:com:appian:types:SHA}SHA_document'())
    ),
    a!save(
    local!mappingKey,
    append(
    local!mappingKey,
    index(local!mappingKey,length(local!mappingKey),null)+1
    )
    )
    },
    size:"SMALL",
    style:"NORMAL",
    showWhen: or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false())
    )

    },
    align: "CENTER",
    marginBelow: "STANDARD"
    ),
    a!buttonLayout(
    primaryButtons: {
    a!buttonWidget(
    label: "Submit",
    value:"Submit",
    saveInto:{
    ri!buttons,
    a!save(ri!listing,local!item),

    },
    submit: true,
    style: "PRIMARY",
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false()),

    )
    },
    secondaryButtons: {
    a!buttonWidget(
    label: "Cancel",
    value:"Cancel",
    saveInto:ri!buttons,
    submit: true,
    style: "DESTRUCTIVE",
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false()),
    validate: false

    )
    }
    )
    }

    )

Reply
  • a!localVariables(
    local!item:'type!{urn:com:appian:types:SHA}SHA_newList'(),
    local!propertyTypeList:rule!SHA_quertyTogetThePropertyTypeName(),
    local!ammenityTypeList:rule!SHA_quertyTogetTheAmmenityType(),
    local!mappingKey: {1},
    local!Doc:'type!{urn:com:appian:types:SHA}SHA_document'(),

    {
    a!sectionLayout(
    label:"",
    contents:{
    a!richTextDisplayField(
    label:"",
    value: a!richTextItem(
    text:"Add Listing ",
    size:"LARGE",
    style:"STRONG"
    )
    )
    },
    divider:"BELOW"
    ),
    a!sectionLayout(
    label:"",
    contents: {
    a!richTextDisplayField(
    labelPosition:"COLLAPSED",
    value: {
    a!richTextItem(
    text: {
    a!richTextIcon(icon:"industry"),
    "Listing"
    },
    color:"STANDARD",
    size:"MEDIUM_PLUS",
    style:"STRONG"
    )
    })},
    divider:"BELOW"
    ),
    a!forEach(
    items:if(
    or(ri!isReadOnly,ri!isEditable),
    ri!listing,
    local!item
    ),
    expression:
    a!localVariables(
    local!ammenities,
    local!document,
    local!mappingId:index(local!mappingKey,fv!index,null),
    a!boxLayout(
    label:"Listing" & fv!index,
    contents: {
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!dropdownField(
    label:"Property Type",
    placeholder:"select a type",
    choiceLabels:index(local!propertyTypeList,"propertyTypeNm",null),
    choiceValues:index(local!propertyTypeList,"propertyTypeId",null),
    value:fv!item.propertyTypeIdFk,
    saveInto:{
    a!save(fv!item.mappingKey,local!mappingId),
    fv!item.propertyTypeIdFk

    },
    required:true,
    disabled: ri!isReadOnly=true()
    )
    ),
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Name",
    placeholder:"enter the Name",
    value:fv!item.propertyName,
    saveInto:fv!item.propertyName,
    readOnly:ri!isReadOnly
    )

    )}),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Description",
    placeholder: "enter the description",
    value:fv!item.propertyDescription,
    saveInto:fv!item.propertyDescription,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:
    a!textField(
    label:"Property Address",
    value:fv!item.propertyAddress,
    saveInto:fv!item.propertyAddress,
    readOnly:ri!isReadOnly
    )

    )

    }),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:
    a!textField(
    label:"Floor PlaneName",
    value:fv!item.floorPlanName,
    saveInto:fv!item.floorPlanName,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:a!textField(
    label:"Neighborhood",
    value:fv!item.neighborhood,
    saveInto:fv!item.neighborhood,
    readOnly:ri!isReadOnly
    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:a!textField(
    label:"Price",
    value:fv!item.price,
    saveInto:fv!item.price,
    readOnly:ri!isReadOnly
    )

    ),
    a!sideBySideItem(
    item:a!textField(
    label:"Square FootAge",
    value:fv!item.squareFootage,
    saveInto:fv!item.squareFootage,
    readOnly:ri!isReadOnly
    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!dropdownField(
    label:"Bed Rooms",
    placeholder:"select a value",
    choiceLabels:cons!SHA_BEDROOMLIST,
    choiceValues:cons!SHA_BEDROOMLIST,
    value:fv!item.bedRooms,
    saveInto:fv!item.bedRooms,
    disabled:ri!isReadOnly


    )
    ),
    a!sideBySideItem(
    item:a!dropdownField(
    label:"Bath Rooms",
    placeholder:"select a value",
    choiceLabels:cons!SHA_BEDROOMLIST,
    choiceValues:cons!SHA_BEDROOMLIST,
    value:fv!item.bathRooms,
    saveInto:fv!item.bathRooms,
    disabled:ri!isReadOnly

    )
    )

    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item:a!dropdownField(
    label:"Pets",
    placeholder:"select a value",
    choiceLabels:{"Cat","Dogs","Kangoors","Rabbits","Tortoise","none"},
    choiceValues:{"Cat","Dogs","Kangoors","Rabbits","Tortoise","none"},
    value:fv!item.pets,
    saveInto:fv!item.pets,
    disabled:ri!isReadOnly

    )
    ),
    a!sideBySideItem(
    item:
    a!radioButtonField(
    label:"Double Occupancy",
    choiceLabels:{"Yes","No"},
    choiceValues:{"Yes","No"},
    value:fv!item.doubleOccupancy,
    saveInto:fv!item.doubleOccupancy,
    disabled:ri!isReadOnly


    )
    )


    }),
    a!multipleDropdownField(
    label: "Ammenities",
    placeholder: "chooose",
    choiceLabels: index(local!ammenityTypeList,"ammenityTypeNm",null),
    choiceValues: index(local!ammenityTypeList,"ammenityTypeId",null),
    value:
    if(
    or(ri!isReadOnly,ri!isEditable),
    ri!ammenities.ammenityTypeIdFk,
    local!ammenities
    ),
    saveInto: {
    local!ammenities,
    a!save(
    ri!ammenities,
    a!forEach(
    items:local!ammenities,
    expression: 'type!{urn:com:appian:types:SHA}SHA_newAmmenities'(
    ammenityTypeIdFk: fv!item,
    mappingKey: local!mappingId
    )
    )
    )
    },
    disabled: ri!isReadOnly
    ),
    a!sectionLayout(
    label:"",
    contents: {
    a!richTextDisplayField(
    labelPosition:"COLLAPSED",
    value:{
    a!richTextIcon(
    icon:"file-text",
    color:"ACCENT",
    size:"LARGE"
    ),
    a!richTextItem(
    text:"Document",
    color:"SECONDARY",
    size:"LARGE",
    style:"STRONG"
    )
    }
    )
    },
    divider:"BELOW"
    ),
    a!gridLayout(
    label:"",
    headerCells:{
    a!gridLayoutHeaderCell(label:"Upload"),
    a!gridLayoutHeaderCell(label:"DocDescription"),
    a!gridLayoutHeaderCell(label:" ", align: "LEFT")
    },
    columnConfigs:{},
    rows:{
    a!forEach(
    items:
    if(
    or(ri!isReadOnly,ri!isEditable),
    ri!Document,
    ri!Document),
    expression:a!gridRowLayout(
    contents:{
    a!fileUploadField(
    label:"Upload Document",
    target:cons!SHA_FOLDER,
    maxSelections:1,
    value:fv!item.appianDocId,
    saveInto: fv!item.appianDocId,
    required: true(),
    requiredMessage:"Please upload document",
    disabled:{ri!isReadOnly}
    ),
    a!textField(
    label:"docdescription",
    placeholder:"enter doc description",
    value:fv!item.docDescription,
    saveInto:fv!item.docDescription,
    required: true(),
    readOnly:ri!isReadOnly

    ),
    a!richTextDisplayField(
    label: "Rich Text",
    labelPosition: "COLLAPSED",
    value: {a!richTextIcon(
    icon: "TIMES",
    link: a!dynamicLink(
    saveInto: a!save(ri!Document,remove(ri!Document,fv!index)),
    showWhen:or(ri!isEditable,ri!isReadOnly=false()),

    ),
    color:"NEGATIVE"
    )}
    )

    }
    )
    )
    },
    selectionValue:ri!Document,
    selectionSaveInto:ri!Document,
    selectable: {},
    selectionRequired:false,
    selectionDisabled:{},
    addRowLink:a!dynamicLink(
    label: "Upload New File",
    value:true(),
    saveInto:{
    a!save(ri!Document,append(ri!Document,{ local!Doc})),
    a!save(
    ri!Document.mappingKey,tointeger(local!mappingId)
    )
    },
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false())

    ),
    validations: {},
    shadeAlternateRows:true

    )
    })
    )),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "ADD ANOTHER LIST",
    icon: "plus-circle",
    value:
    if(or(ri!isEditable,ri!buttons),
    ri!listing,
    local!item),
    saveInto:{
    a!save(
    local!item,
    append(local!item,'type!{urn:com:appian:types:SHA}SHA_newList'())
    ),
    a!save(
    local!Doc,
    append(local!Doc,'type!{urn:com:appian:types:SHA}SHA_document'())
    ),
    a!save(
    local!mappingKey,
    append(
    local!mappingKey,
    index(local!mappingKey,length(local!mappingKey),null)+1
    )
    )
    },
    size:"SMALL",
    style:"NORMAL",
    showWhen: or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false())
    )

    },
    align: "CENTER",
    marginBelow: "STANDARD"
    ),
    a!buttonLayout(
    primaryButtons: {
    a!buttonWidget(
    label: "Submit",
    value:"Submit",
    saveInto:{
    ri!buttons,
    a!save(ri!listing,local!item),

    },
    submit: true,
    style: "PRIMARY",
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false()),

    )
    },
    secondaryButtons: {
    a!buttonWidget(
    label: "Cancel",
    value:"Cancel",
    saveInto:ri!buttons,
    submit: true,
    style: "DESTRUCTIVE",
    showWhen:or(not({ri!isReadOnly=true()}),ri!isEditable,ri!isReadOnly=false()),
    validate: false

    )
    }
    )
    }

    )

Children