Here I have a Plan TypeWithin Plan Type Sum Insured (Min Val and Max Val)Within Sum Insured Year Range (Min Year and Max Year)Within Year Range service center (Agency or Garage)1. I should be able to duplicate whole transaction2. I should be able to add multiple Sum Insured (Min Val and Max Val). 3. When I add this, within Sum Insured I should be able to add multiple Year Range 4. Within Year Range I should be able to add multiple service centers ( 1 Agency and 1 Garage)Now with the current code If I add a Transaction, 2 Transactions are getting addedAfter filling details if I add another transaction, all the values getting disappeared from the 1st transaction If I add Year Range I am getting the following error message (An error occurred while executing a save: Expression evaluation error at function a!map parameter 3 [line 328]: Cannot add incompatible operands of type Null and type Number (Integer).)
a!localVariables( local!index: 1, local!planType: {a!map(planType: "", index: local!index)}, local!sumIns: { a!map( minValSi: "", maxValSi: "", sumIndex: local!index, index: local!index ) }, local!yrRange: { a!map( minYear: "", maxYear: "", yrIndex: local!index, index: local!index ) }, local!sumInsTrans: { a!map( agency: "", percentage: "", flat: "", minimumPremium: "", excess: "", suminsIndex: local!index, index: local!index ) }, local!extension: { a!map( extncover: "", mndtoptn: "", relsumins: "", flat_ext: "", percentage_ext: "", index: local!index ) }, { a!richTextDisplayField( align: "RIGHT", value: { a!richTextItem( text: { "New Transaction" }, color: "ACCENT", size: "MEDIUM", style: "STRONG" ), }, ), a!richTextDisplayField( value: a!richTextIcon( icon: "plus", altText: "New", size: "MEDIUM", link: a!dynamicLink( saveInto: { a!save( local!planType, append( local!planType, a!map( planType: "", index: local!index + count(local!planType) ) ) ), a!save( local!sumIns, append( local!sumIns, a!map( minValSi: "", maxValSi: "", sumIndex: local!index + 1, index: local!index + count(local!sumIns) ) ) ), a!save( local!yrRange, append( local!yrRange, a!map( minYear: "", maxYear: "", yrIndex: local!index + 1, index: local!index + count(local!yrRange) ) ) ), a!save( local!sumInsTrans, append( local!sumInsTrans, a!map( agency: "", percentage: "", flat: "", minimumPremium: "", excess: "", suminsIndex: local!index + 1, index: local!index + count(local!sumInsTrans) ) ) ), a!save( local!extension, append( local!extension, a!map( extncover: "", mndtoptn: "", relsumins: "", flat_ext: "", percentage_ext: "", index: local!index + count(local!extension) ) ) ), a!save( ri!planType, local!planType ), a!save( ri!sumins, local!sumIns ), a!save( ri!yrRange, local!yrRange ), a!save( ri!sumInsTrans, local!sumInsTrans ), a!save( ri!extension, local!extension ) } ) ), align: "RIGHT" ), a!forEach( items: ri!planType, expression: a!cardLayout( contents: { a!richTextDisplayField( value: { a!richTextItem( text: { "Plan Type" }, color: "ACCENT", size: "MEDIUM", style: "STRONG" ), } ), a!dropdownField( label: "", placeholder: " ", choiceLabels: { "Platinum", "Gold", "Silver" }, choiceValues: { "Platinum", "Gold", "Silver" }, value: index(fv!item, "planType", null), saveInto: { fv!item.planType, /*a!save(ri!ratingTransaction,save!value)*/ } ), a!richTextDisplayField( value: { a!richTextItem( text: { "Sum Insured" }, color: "ACCENT", size: "MEDIUM", style: "STRONG" ), } ), a!richTextDisplayField( value: a!richTextIcon( icon: "plus", link: a!dynamicLink( saveInto: { a!save( local!sumIns, append( local!sumIns, a!map( minValSi: "", maxValSi: "", sumIndex: local!index + 1, index: index(fv!item, "index", null) ) ) ), a!save( local!yrRange, append( local!yrRange, a!map( minYear: "", maxYear: "", yrIndex: local!index, index: count(local!sumIns) ) ) ), a!save( local!sumInsTrans, append( local!sumInsTrans, a!map( agency: "", percentage: "", flat: "", minimumPremium: "", excess: "", suminsIndex: local!index, index: count(local!yrRange) ) ) ), a!save( ri!sumins, local!sumIns ), a!save( ri!yrRange, local!yrRange ), a!save( ri!sumInsTrans, local!sumInsTrans ), a!save( ri!extension, local!extension ) } ), linkStyle: "STANDALONE" ), align: "RIGHT" ), a!forEach( items: ri!sumins[wherecontains( index(fv!item, "index", null), index(ri!sumins, "index", null) )], expression: a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Minimum Value", value: index(fv!item, "minValSi", ""), saveInto: fv!item.minValSi, readOnly: ri!readOnly, ) } ), a!columnLayout( contents: { a!textField( label: "Maximum Value", value: index(fv!item, "maxValSi", ""), saveInto: fv!item.maxValSi, readOnly: ri!readOnly, ) } ), a!columnLayout( contents: a!richTextDisplayField( value: { char(10), a!richTextIcon( icon: "remove", color: "NEGATIVE", link: a!dynamicLink( saveInto: a!save( ri!sumins, remove(local!sumIns, fv!index) ) ), linkStyle: "STANDALONE" ) } ), width: "EXTRA_NARROW" ) } ), a!richTextDisplayField( value: { a!richTextItem( text: { "Year Range" }, color: "ACCENT", size: "MEDIUM", style: "STRONG" ), } ), a!richTextDisplayField( value: a!richTextIcon( icon: "plus", link: a!dynamicLink( saveInto: { a!save( local!yrRange, append( local!yrRange, a!map( minYear: "", maxYear: "", yrIndex: index(fv!item, "yrIndex", null) + 1, index: index(fv!item, "index", null) ) ) ), a!save( local!sumInsTrans, append( local!sumInsTrans, a!map( agency: "", percentage: "", flat: "", minimumPremium: "", excess: "", suminsIndex: index(fv!item, "suminsIndex", null) + 1, index: index(fv!item, "index", null) ) ) ), a!save( ri!yrRange, local!yrRange ), a!save( ri!sumInsTrans, local!sumInsTrans ) } ), linkStyle: "STANDALONE" ), align: "RIGHT" ), a!cardLayout( contents: { a!forEach( items: ri!yrRange[wherecontains( index(fv!item, "index", null), index(ri!yrRange, "yrIndex", null) )], expression: { a!columnsLayout( columns: { a!columnLayout( contents: { a!dateField( label: "Minimum Year", labelPosition: "ABOVE", value: index(fv!item, "minYr", ""), saveInto: fv!item.minYr, validations: {} ) } ), a!columnLayout( contents: { a!dateField( label: "Maximum Year", labelPosition: "ABOVE", value: index(fv!item, "maxYr", ""), saveInto: fv!item.maxYr, validations: {} ) } ), a!columnLayout( contents: a!richTextDisplayField( value: { char(10), a!richTextIcon( icon: "remove", link: a!dynamicLink( saveInto: a!save( ri!yrRange, remove(local!yrRange, fv!index) ) ), linkStyle: "STANDALONE", color: "NEGATIVE" ) } ), width: "EXTRA_NARROW" ) } ), a!forEach( items: ri!sumInsTrans[wherecontains( index(fv!item, "index", null), tointeger(index(ri!sumInsTrans, "index", null)) )], expression: a!cardLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!radioButtonField( label: "Agency", choiceLabels: { " Agency", "Garage" }, choiceValues: { true(), false() }, value: index(fv!item, "isAgency", ""), saveInto: fv!item.isAgency, disabled: ri!readOnly, choiceLayout: "COMPACT", choiceStyle: "STANDARD" ) } ), a!columnLayout( contents: { a!textField( label: "Percentage", value: index(fv!item, "percentage", ""), saveInto: fv!item.percentage, readOnly: ri!readOnly, disabled: fv!item.flat ) } ), a!columnLayout( contents: { a!integerField( label: "Flat", value: index(fv!item, "flat", ""), saveInto: fv!item.flat, readOnly: ri!readOnly, disabled: fv!item.percentage ) } ), a!columnLayout( contents: { a!textField( label: "Minimum Premium", value: index(fv!item, "minimumPremium", ""), saveInto: fv!item.minimumPremium, readOnly: ri!readOnly ) } ), a!columnLayout( contents: { a!textField( label: "Excess", value: index(fv!item, "excess", ""), saveInto: fv!item.excess, readOnly: ri!readOnly ) } ), a!columnLayout( contents: a!richTextDisplayField( value: { char(10), a!richTextIcon( icon: "remove", link: a!dynamicLink( saveInto: a!save( ri!sumInsTrans, remove(local!sumInsTrans, fv!index) ) ), linkStyle: "STANDALONE", color: "NEGATIVE" ) } ), width: "EXTRA_NARROW" ) } ) } ) ), a!richTextDisplayField( value: a!richTextItem( text: "+ Add new row", link: a!dynamicLink( saveInto: a!save( ri!sumInsTrans, append( ri!sumInsTrans, a!map( isAgency: "", percentage: "", flat: "", minimumPremium: "", excess: "", suminsIndex: index( ri!sumInsTrans[wherecontains( index(fv!item, "index", null), index(ri!sumInsTrans, "index", null) )], 1, "suminsIndex", null ) + 1, index: index(fv!item, "index", "") ) ) ) ), style: "STRONG" ) ) } ) } ), } ) ), a!cardLayout( contents: { a!richTextDisplayField( value: a!richTextItem( text: "Coverage Extension", style: "STRONG", size: "MEDIUM", color: "ACCENT" ) ), a!forEach( items: ri!extension[wherecontains( index(fv!item, "index", null), index(ri!extension, "index", null) )], expression: a!columnsLayout( columns: { a!columnLayout( contents: { a!dropdownField( label: "Extension Coverage", placeholder: "select extension", choiceLabels: { "Medical Coverage", "Travel Inco Coverage", "Terrorism Coverage", "Haz sport coverage", "Personal Accident", }, choiceValues: { 1, 2, 3, 4, 5 }, value: index(fv!item, "extncover", ""), saveInto: fv!item.extncover, disabled: ri!readonly, validations: if( count( wherecontains( tointeger(index(fv!item, "extncover", "")), tointeger( index( ri!extension[wherecontains( index(fv!item, "index", null), index(ri!extension, "index", null) )], "extncover", null ) ) ) ) > 1, "Extension Already exists", null ) ) } ), a!columnLayout( contents: { a!dropdownField( label: "Mandatory", placeholder: " ", choiceLabels: { "Mandatory", "Optional" }, choiceValues: { true(), false() }, value: index(fv!item, "mndtoptn", null), saveInto: fv!item.mndtoptn, disabled: ri!readonly ) } ), /*a!columnLayout(*/ /*contents: {*/ /*a!textField(*/ /*label: "Relational Sum Insurred",*/ /*value: index(fv!item, "relsumins", ""),*/ /*saveInto: fv!item.relsumins,*/ /*readOnly: ri!readonly*/ /*)*/ /*}*/ /*),*/ a!columnLayout( contents: { a!textField( label: "Flat", placeholder: " ", value: index(fv!item, "flat_ext", ""), saveInto: fv!item.flat_ext, disabled: fv!item.percentage_ext, readOnly: ri!readonly ) } ), a!columnLayout( contents: { a!textField( label: "Percentage", value: index(fv!item, "percentage_ext", ""), saveInto: fv!item.percentage_ext, disabled: fv!item.flat_ext, readOnly: ri!readonly ) } ), a!columnLayout( contents: a!richTextDisplayField( value: { char(10), a!richTextIcon( icon: "remove", color: "NEGATIVE", link: a!dynamicLink( saveInto: a!save( ri!extension, remove(ri!extension, fv!index) ) ), linkStyle: "STANDALONE" ) } ), width: "EXTRA_NARROW" ) } ) ), a!richTextDisplayField( value: a!richTextItem( text: "+ Add New Row", style: "STRONG", link: a!dynamicLink( saveInto: { a!save( ri!extension, append( ri!extension, a!map( extncover: "", mndtoptn: "", relsumins: "", flat_ext: "", percentage_ext: "", index: index(fv!item, "index", null) ) ) ) } ) ) ) } ) }, height: "AUTO", style: "NONE", shape: "ROUNDED", padding: "MORE", marginBelow: "LESS", showWhen: ri!showWhen ) ) } )
Discussion posts and replies are publicly visible