/* Rule Name: TEST_gridRowLayout inputs: items (AnyType) index (number(integer)) */ =a!gridRowLayout( id: ri!index, contents: { a!textField( /* Labels are not visible in grid cells but are necessary to meet accessibility requirements `*/ label: "summary " & ri!index, value: ri!items[ri!index].summary, saveInto: ri!items[ri!index].summary, required: true ), a!integerField( label: "qty " & ri!index, value: ri!items[ri!index].first_value, saveInto: ri!items[ri!index].first_value, align: "RIGHT" ), a!floatingPointField( label: "unitPrice " & ri!index, value: ri!items[ri!index].second_value, validations:if(or(isnull(ri!items[ri!index].first_value),isnull(ri!items[ri!index].second_value)), null, if(ri!items[ri!index].first_value < ri!items[ri!index].second_value, "Value2 should be less than Value1", null) ), saveInto: ri!items[ri!index].second_value, align: "RIGHT" ), a!floatingPointField( label: "unitPrice " & ri!index, value: if(or(isnull(ri!items[ri!index].first_value),isnull(ri!items[ri!index].second_value)), null, ri!items[ri!index].first_value-ri!items[ri!index].second_value ), align: "RIGHT" ) } ) ================================ /* Rule Name: TEST_gridRowLayout */ =load( local!items: { type!items(id: null, summary: "Item 1", first_value:5, second_value:6, difference:null), type!items(id: null, summary: "Item 2", first_value:10, second_value:6, difference:null) }, a!formLayout( label: "SAIL Example: Inline Editable Grid", firstColumnContents: { a!gridLayout( headerCells: { a!gridLayoutHeaderCell(label: "Summary"), a!gridLayoutHeaderCell(label: "Value 1", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Value 2", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Difference", align: "RIGHT") }, rows: a!applyComponents( function: rule!TEST_gridRowLayout( items: local!items, index: _ ), array: 1+enumerate(count(local!items)) ) ) }, buttons:{ a!buttonLayout( primaryButtons:{ a!buttonWidgetSubmit( label:"Submit" ) } ) } ) )