Hi Everyone,
My requirement is - I am showing an Admin Form, When The user enters data in the fields, they get stored in the database and I am showing the details in a selectable grid. The user can add a row or update/remove any row by clicking on the particular row from the selectable grid which will show the data for that specific row in the form. It is working fine for text box control to fetch and show as well as be blank while entering a new data row(event).But when it comes to a dropdown(year), I am facing an issue with the below code to fetch and show the field for selected row but be blank and mapped to rule input or local variable while adding a new row, for that control. The data is not getting getting populated into a dropdown. I have added a default value "2022" to avoid the error but, I actually need "ri!HolidayDetails.year" in place of "2022". Kindly help
Thank in advance.
{ a!localVariables( /* This variable is used to persist the checkbox on selected items by holding the identifiers of the selected rows. */ local!selection, /* This variable would be used to pass the full rows of data on the selected items out of this interface, such as to a process model. */ local!selectedEvent, local!selectedRows, local!removedIds, { a!richTextDisplayField( label: "", labelPosition: "COLLAPSED", value: { a!richTextHeader(text: "Saved Holiday List") } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!buttonArrayLayout( buttons: { a!buttonWidget( label: "REMOVE", saveinto: { /* Append the selected rows IDs to the local!removedIds variable. */ a!save( local!removedIds, append( local!removedIds, local!selectedEvent['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{97cb1440-dcbd-4499-b098-55caabbc20aa}id'] ) ), /* Reset local!selectedRows so other rows can be removed. */ a!save(local!selectedEvent, null), /* Reset the grid selection as well. */ a!save(local!selection, null) }, style: "NORMAL", /* Disable the button if local!selectedRows is empty. */ disabled: if( or( isnull(local!selectedEvent), length(local!selectedEvent) < 1 ), true, false ) ), a!buttonWidget( label: "Add", icon: "plus", saveInto: { a!save(ri!HolidayDetails.isactive, true()), a!save( ri!HolidayDetails.createdby, loggedInUser() ), a!save(ri!HolidayDetails.createdon, now()), a!save( ri!HolidayDetails.updatedby, loggedInUser() ), a!save(ri!HolidayDetails.updatedon, now()) }, submit: true, size: "STANDARD", style: "PRIMARY" ) }, align: "START" ), a!gridField( /* Replace the dummy data with a query, rule, or function that returns a datasubset and uses fv!pagingInfo as the paging configuration. */ data: a!recordData( recordType: 'recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar', /* This query filter applies to all rows where the row ID is found in local!removedRows. */ filters: a!queryFilter( field: 'recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{97cb1440-dcbd-4499-b098-55caabbc20aa}id', operator: if( isnull(local!removedIds), "not null", "not in" ), value: local!removedIds ) ), columns: { a!gridColumn( label: "Year", value: fv!row['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{65f69159-6237-4537-b14c-373b46496998}year'], align: "START" ), a!gridColumn( label: "Country", value: fv!row['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{253d3b95-b04e-47a3-bbaf-e89ced1eaae6}country'], align: "START" ), a!gridColumn( label: "Holiday From", value: fv!row['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{97069718-ec96-4f01-a1c5-c8ef90a5f570}fromdate'], align: "START" ), a!gridColumn( label: "Holiday To", value: fv!row['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{55a83b2d-681b-46e3-aafb-b8789e1d3f1c}todate'], align: "START" ), a!gridColumn( label: "Event", value: fv!row['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{fa36f13b-b3b8-4efd-b6f1-41bc332bdb19}event'], align: "START" ) }, pageSize: 3, selectable: true, selectionStyle: "ROW_HIGHLIGHT", selectionValue: local!selection, selectionSaveInto: { local!selection, /* This save adds the full rows of data for items selected in the most recent user interaction to local!selectedEvent. */ a!save( local!selectedEvent, append(local!selectedEvent, fv!selectedRows) ), /* This save removes the full rows of data for items deselected in the most recent user interaction to local!selectedEvent. */ a!save( local!selectedEvent, difference(local!selectedEvent, fv!deselectedRows) ) } ) }, width: "WIDE" ), a!columnLayout( contents: { a!cardLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!dropdownField( label: "Year", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels: { "2021", "2022", "2023" }, choiceValues: { "2021", "2022", "2023" }, value: { if( or( isnull(local!selectedEvent), length(local!selectedEvent) = 0 ), "2022", a!forEach( local!selectedEvent, fv!item['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{65f69159-6237-4537-b14c-373b46496998}year'] ) ) }, saveInto: {}, searchDisplay: "AUTO", validations: {} ) ), a!sideBySideItem( item: a!richTextDisplayField( label: "Selected Holiday", value: { if( or( isnull(local!selectedEvent), length(local!selectedEvent) = 0 ), a!richTextItem(text: "None", style: "EMPHASIS"), a!forEach( local!selectedEvent, { a!richTextIcon(icon: "calendar-day", color: "ACCENT"), " ", a!richTextItem( text: fv!item['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{fa36f13b-b3b8-4efd-b6f1-41bc332bdb19}event'] ), char(10) } ) ) } ) ) } ), a!textField( label: "Event", labelPosition: "ABOVE", value: { if( or( isnull(local!selectedEvent), length(local!selectedEvent) = 0 ), ri!HolidayDetails.event, a!forEach( local!selectedEvent, fv!item['recordType!{9d0c84f1-194c-4fbc-9e87-574eceeafad2}MOB Holiday Calendar.fields.{fa36f13b-b3b8-4efd-b6f1-41bc332bdb19}event'] ) ) }, saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!dateField( label: "From Date", labelPosition: "ABOVE", saveInto: {}, validations: {} ) ), a!sideBySideItem( item: a!dateField( label: "To Date", labelPosition: "ABOVE", saveInto: {}, validations: {} ) ) } ) }, height: "AUTO", style: "NONE", shape: "SEMI_ROUNDED", marginBelow: "STANDARD", showShadow: true ) } ) }, stackWhen: { "PHONE", "TABLET_PORTRAIT" } ) } ) }
Discussion posts and replies are publicly visible
Hi Swetha, from your requirement , i think you want to show value conditionally , either based on "Add" button or grid selection. Correct me if i am wrong. From this understanding what i would suggest is to have two boolean variables , one for grid selection and one for add button and then based on these two variables decide your value in the dropdown. You will have to make sure when these buttons should be true or false.
ok Gopal, let me try that as well. Thank you