Hi All,
i have a grid to add master details, i want to have an validations to check on Duplicate values
please help me with the same, below is code i have written for grid and saving into CDT then passing it to Process model,
a!boxLayout( label: if(or(isnull(ri!typeValueSelected),ri!typeValueSelected = 0), "Type", rule!LMP_getTypesListByFilters( typeid: ri!typeValueSelected ).description), contents: { a!gridLayout( label: "", headerCells: { a!gridLayoutHeaderCell( label: "Name" ), a!gridLayoutHeaderCell( label: "Active" ), a!gridLayoutHeaderCell( label: "" ), a!gridLayoutHeaderCell( label: "" ) }, columnConfigs: { a!gridLayoutColumnConfig(), a!gridLayoutColumnConfig( width: "ICON" ), a!gridLayoutColumnConfig( width: "ICON" ), a!gridLayoutColumnConfig( width: "ICON" ) }, rows: a!forEach( items: local!AllValuesMaster, expression: a!gridRowLayout( contents: { a!textField( value: fv!item.description, saveinto: fv!item.description, required: true ), a!checkboxField( label: "gbe-active", choiceLabels: { "" }, choiceValues: { true() }, value: if( or( isnull( fv!item.activein ), not( fv!item.activein ) ), null, toboolean( fv!item.activein ) ), saveInto: { a!save( fv!item.activein, if( isnull( save!value ), false(), save!value ) ) }, align: "CENTER" ), a!imageField( label: "delete " & fv!index, images: a!documentImage( document: a!iconIndicator( "MOVE_UP" ), altText: "Up", caption: "Move Up ", link: a!dynamicLink( value: fv!index, saveInto: { if( fv!index = 1, {}, { a!save( local!AllValuesMaster, insert( local!AllValuesMaster, fv!item, fv!index - 1 ) ), a!save( local!AllValuesMaster, remove( local!AllValuesMaster, fv!index + 1 ) ) } ) } ) ), size: "ICON" ), a!imageField( label: "delete " & fv!index, images: a!documentImage( document: a!iconIndicator( "MOVE_DOWN" ), altText: "Down", caption: "Move Down ", link: a!dynamicLink( value: fv!index, saveInto: { if( fv!index = count( local!AllValuesMaster ), {}, { a!save( local!AllValuesMaster, insert( local!AllValuesMaster, fv!item, fv!index + 2 ) ), a!save( local!AllValuesMaster, remove( local!AllValuesMaster, fv!index ) ) } ) } ) ), size: "ICON" ) } ) ), addRowLink: a!dynamicLink( label: "Add " & if(or(isnull(ri!typeValueSelected),ri!typeValueSelected = 0), "Type", rule!LMP_getTypesListByFilters( typeid: ri!typeValueSelected ).description), saveInto: a!save( local!AllValuesMaster, append( local!AllValuesMaster, 'type!{urn:com:appian:types:LMP}LMP_REF_AllValues_VW'( activein: true(), typeid: ri!typeValueSelected ) ) ) ), shadeAlternateRows: true ), a!buttonLayout( primaryButtons: a!buttonWidget( label: "Submit", submit: true, value: cons!LMP_BUTTON_VALUES[5], saveInto: { if(ri!typeValueSelected = "1", a!save( ri!regionData, local!AllValuesMaster ),null), if(ri!typeValueSelected = "2", a!save( ri!sbgData, local!AllValuesMaster ),null), if(ri!typeValueSelected = "3", a!save( ri!sbuData, local!AllValuesMaster ),null), if(ri!typeValueSelected = "10", a!save( ri!functionData, local!AllValuesMaster ),null), if(ri!typeValueSelected = "17", a!save( ri!subRegionData, local!AllValuesMaster ),null), if(ri!typeValueSelected = "11", a!save( ri!countryData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "14", a!save( ri!bandData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "7", a!save( ri!ratingData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "15", a!save( ri!nineblockingData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "6", a!save( ri!jobfunctionData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "16", a!save( ri!programTemplateData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "13", a!save( ri!potentialratingData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "5", a!save( ri!ethnicityData, local!AllValuesMaster ) ,null), if(ri!typeValueSelected = "8", a!save( ri!demographicData, local!AllValuesMaster ) ,null), a!save( ri!buttonValue, "submit" ) } ), secondaryButtons: a!buttonWidget( label: "Cancel", style: "DESTRUCTIVE", submit: true, value: cons!LMP_BUTTON_VALUES[7], saveInto: {a!save( ri!buttonValue, "cancel" )}, skipValidation:true ) ) }, showWhen: contains(local!value, ri!typeValueSelected) )
Discussion posts and replies are publicly visible
What exactly do you want this validation to do?
hi Mike,
when a user adds a new row in the grid, and key in Duplicate record, it should say, record already exists,
or even, it takes the value from the Interface, but when writing to database , it should load only unique values.
Warm Regards
Hi All, Can anyone please help me on this