rule!PD_ProductCodesGrid(ri!cdtPDProductCodes,iDeletedItem, ri!cdtPDStageGateRequestDetails ), a!linkField( label: "Add Link", labelPosition: "COLLAPSED", links: a!dynamicLink( label: "Add a Product", value: { iId:0, iRequestId:ri!iInitiativeID, iVersion:0 }, saveInto: { a!save( ri!cdtPDProductCodes, append( ri!cdtPDProductCodes, save!value ) ), /*` When modifying the size of the array used in a!applyComponents, */ /* make the same change in the "token" array variable */ a!save( local!itemsToken, append( local!itemsToken, save!value ) ) } ) ) ===================================================================Second rule===================================== load( local!itemsToken, a!gridLayout( instructions: "Special Codes are represented in parentheses(SxS for Side by Side, AON for All or None). UDS groups are also represented in parentheses.", headerCells: { a!gridLayoutHeaderCell( label: "Product Name" ), a!gridLayoutHeaderCell( label: "PRS Code" ), a!gridLayoutHeaderCell( label: "Clearing Code" ), /*if( contains( { ri!cdtStageGateRequestDetails.tVenue }, cons!PD_VENUE_GLOBEX ),*/ a!gridLayoutHeaderCell( label: "Globex Code" )/*, {} ) */, a!gridLayoutHeaderCell( label: "Special Codes" ), a!gridLayoutHeaderCell( label: "Existing Group Codes" ), a!gridLayoutHeaderCell( label: "New Group Codes" ), a!gridLayoutHeaderCell( label: "" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), /* if( contains( { ri!cdtStageGateRequestDetails.tVenue }, cons!PD_VENUE_GLOBEX ),*/ a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" )/*, {} )*/, a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "" ), a!gridLayoutColumnConfig( width: "ICON" ) }, rows: a!applyComponents( function: rule!PD_addProductRowEachItem( _, ri!iDeletedItem, local!itemsToken, ri!updateItem, ri!cdtStageGateRequestDetails ), array: if( or( isnull( ri!updateItem ), count( ri!updateItem ) < 1 ), {}, 1 + enumerate( count( ri!updateItem ) ) ), arrayVariable: local!itemsToken ) ) ) =================================================Third Rule=================================================== with(a!gridRowLayout( id: ri!index, contents: { a!textField( label: "Product Name" & ri!index, readOnly: false, required:true, value: ri!items[ri!index].tProductName , saveInto: ri!items[ri!index].tProductName ), a!textField( label: "PRS Code" & ri!index, readOnly: false, required:false, value: ri!items[ri!index].tPRSCode , saveInto: ri!items[ri!index].tPRSCode ), a!textField( label: "Clearing Code"& ri!index, readOnly: false, required:false, value: ri!items[ri!index].tClearingCode , saveInto: ri!items[ri!index].tClearingCode ), /* if( contains( { ri!cdtStageGateRequestDetails.tVenue }, cons!PD_VENUE_GLOBEX ),*/ a!textField( label: "Globex Code" & ri!index, readOnly: false, required:false, value: if( rule!PD_IsCheckNull( ri!items ), {}, ri!items[ri!index].tGlobexCode ), saveInto: { ri!items[ri!index].tGlobexCode } )/*, {} )*/, a!textField( label: "Special Codes" & ri!index, readOnly: false, required:false, value: ri!items[ri!index].tSpecialCodes , saveInto: ri!items[ri!index].tSpecialCodes ), a!textField( label: "Existing Group Codes" & ri!index, readOnly: false, required:false, value: ri!items[ri!index].tExistingGroupCodes , saveInto: ri!items[ri!index].tExistingGroupCodes ), a!textField( label: "New Group Codes" & ri!index, readOnly: false, required:false, value: ri!items[ri!index].tNewGroupCodes , saveInto: ri!items[ri!index].tNewGroupCodes ), a!linkField( label: "delete " & ri!index, links: a!dynamicLink( label: char(10005), value: ri!index, saveInto: { a!save(ri!deletedItemIds, append(ri!deletedItemIds, index(ri!items.tProductName, save!value, null))), a!save(ri!items, remove(ri!items, save!value)), /*` When modifying the size of the array used in a!applyComponents, */ /* make the same change in the "token" array variable */ a!save(ri!itemsToken, remove(ri!itemsToken, save!value)) }, align: "CENTER" ) ) } ))