Hi,
I'm trying a simple code using an Interface containing a RecordType based grid, and I need to pass the 'fv!row' to an ER to make some fields calculations/traitements for the current row.
In this example (below), all works fine because I've used the workaround to add the column "year" in the grid (showWhen = false, because I do not want to display this column in my example).
If I remove this column from the Grid, it seems that the "year" field is reset to null in 'fv!row', so the ER can not work with this field anymore as it is always set to null.
Could you tell me why there is such an issue ? passing RecordType 'fv!row' automatically casted into CDT seems to work yet.
How would you do to make it working (removing definitively the "year" column) ?
*** Interface : a!formLayout( label: "Grid with RecordType", contents: { a!gridField( label: "Vehicles", labelPosition: "COLLAPSED", data: a!recordData( recordType:'recordType!CJT_R_Vehicles', filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!CJT_R_Vehicles.fields.deleted', operator: "=", value: false ), }, ignoreFiltersWithEmptyValues: true ) ), columns: { a!gridColumn( label: "Id", sortField: 'recordType!CJT_R_Vehicles.fields.id', value: fv!row['recordType!CJT_R_Vehicles.fields.id'], align: "END" ), a!gridColumn( label: "Model", sortField: 'recordType!CJT_R_Vehicles.fields.model', value: fv!row['recordType!CJT_R_Vehicles.fields.model'] ), /* If this column is removed the code does not work: the "year" field is not concatened in the Calculation field below */ a!gridColumn( label: "Year", sortField: 'recordType!CJT_R_Vehicles.fields.year', value: fv!row['recordType!CJT_R_Vehicles.fields.year'], showWhen: false ), /* Grid to display some traitments/calculations fields */ a!gridColumn( label: "Calculation", value: rule!CJT2_CalculateFromCurrentRow( vehicle: fv!row, ) ), }, ), }, ) *** ER CJT2_CalculateFromCurrentRow : RI : ri!vehicle (type: CJT_Vehicle) if(a!isNotNullOrEmpty(ri!vehicle), ri!vehicle.id & "-" & ri!vehicle.year, "empty" )
Discussion posts and replies are publicly visible
Seems like a!recordData only fetches the fields directly used in the grid. Then you solution with hiding the column would be the only option.
Otherwise, you could also use a!queryRecordType to fetch the data.
Thank you Stefan.Yes, you're right I can use a!queryRecordType instead.
I mean that you could use queryRecordType in line 9 to feed the data to the whole grid instead of recordData. Using the fields parameter you can define which fields to include.
Yes, I understand (I've edited my reply just before yours ;-) )Thank you