I have an interface that will be used by parish managers to fill out a Parish Profile. We have some of the Parish Profiles set up from last year and some of the Parish Managers fill out the profile for more than one parish.
So the interface takes in the logged in user and retrieves the Parish Profiles for the user. This can return null, one or more parish profiles depending upon the User.
1 and 2 work great. My problem is with number 3.
I have two local variables; selectedParishProfile and updatedParishProfile. The selectedParishProfile is set when the user selects a row from the grid. The updatedParishProfile is used in the form interface as the values for the fields. The following is the initiation of the variables.
local!selectedParishProfile: cast( 'recordType!PMSO Parish Profile', null ), local!updatedParishProfile: if( local!parishCount > 1, local!selectedParishProfile, if( local!parishCount = 1, local!parishProfiles[1], cast( 'recordType!PMSO Parish Profile', null ) ) ),
When I select the Parish from the grid, I can see that both of these variables have data.
Here are the variables prior to the selection.
Here are the variables after the selection.
My problem is that the interface does not show any data. All of the fields are blank even though the variable updatedParishProfile has data.
Is this a refresh issue?
Discussion posts and replies are publicly visible
Chris.Gillespie said:When I select the Parish from the grid
What is your code for grid selection? Does the data typing within the local variable (which you screenshotted just a tiny bit of an overview of) line up with your record type, or has it accidentally gotten translated into something else (like a flat dictionary, or maybe an "array of 1" of your record type instead of a single instance of it)?
a!gridField( label: "Parishes for User", labelPosition: "COLLAPSED", data: local!parishProfiles, columns: { a!gridColumn( label: "Parish", value: rule!PMSO_getParishNameTextbyParishID( fv!row['recordType!PMSO Parish Profile.fields.parishId'] ) ) }, selectable: true, selectionStyle: "CHECKBOX", selectionValue: index( local!selectedParishProfile, "parishId", {} ), selectionSaveInto: { a!save( target: local!selectedParishProfile, value: if( length(fv!selectedRows) > 0, fv!selectedRows[length(fv!selectedRows)], null ) ), a!save( local!updatedParishProfile, local!selectedParishProfile ) }, selectionRequired: true, selectionRequiredMessage: "Please select the Parish to update the profile.", maxSelections: 1, shadeAlternateRows: true )
What (exact) data type(s) do the local variables "local!parishProfiles" as well as "local!updatedParishProfile" resolve as, i.e. when you click on the variable in the local variables panel to check the underlying data type? I'm a little confused whether they're resolving as "record type data" or as standard dictionaries, and some of your usage goes back and forth between styles (such as your "selectionValue" parameter here getting the simple "parishId" property via index(), instead of using a record type property for it).
ITS A MAP!!! Do I have to cast it as a Record Type?
I put a cast function in when I declare the local variable updatedParishProfile and now it works!!!!
Thanks again Mike!!!
local!updatedParishProfile: a!refreshVariable( value: if( local!parishCount > 1, cast('recordType!PMSO Parish Profile',local!selectedParishProfile), if( local!parishCount = 1, local!parishProfiles[1], cast( 'recordType!PMSO Parish Profile', null ) ) ), refreshAlways: true ),