Hello Team,
I have build an editable grind and now I want to save the values inside my records. I have record table and rule input in my interface the problem is how I can save this data for each request I have. The data is a sample there are around 15 rows which I want the user to be able to save some of them can be null some of them can be filled out. Basically the property is read only, once user enter value we can use a!save to save the property for the respective row, but I always get cannot index rule input records..
rows: { a!gridRowLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: {"Melting Point"} ) } ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", disabled: false, validations: {} ), a!dropdownField( choiceLabels: {"g/cm3", "kg/m3"}, choiceValues: {"g/cm3", "kg/m3"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "Select", saveInto: {}, searchDisplay: "AUTO", validations: {} ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( choiceLabels: {"℃", "℉"}, choiceValues: {"℃", "℉"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "Select", saveInto: {}, searchDisplay: "AUTO", validations: {} ), a!dropdownField( choiceLabels: {"Property has not been measured"}, choiceValues: {"Property has not been measured"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", saveInto: {}, searchDisplay: "AUTO", validations: {} ) }, showWhen: if( or( ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "LIquid", ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "Solid", ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "" ), true, false) ), a!gridRowLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: {"Freezing Point"} ) } ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", disabled: false, validations: {} ), a!dropdownField( choiceLabels: {"g/cm3", "kg/m3"}, choiceValues: {"g/cm3", "kg/m3"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "Select", saveInto: {}, searchDisplay: "AUTO", validations: {} ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Text", labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( choiceLabels: {"℃", "℉"}, choiceValues: {"℃", "℉"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "Select", saveInto: {}, searchDisplay: "AUTO", validations: {} ), a!dropdownField( choiceLabels: {"Property has not been measured"}, choiceValues: {"Property has not been measured"}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", saveInto: {}, searchDisplay: "AUTO", validations: {} ) }, showWhen: if( or( ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "LIquid", ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "Solid", ri!AOS_PhysChem['recordType!{1ddc2dbc-133e-49a3-a416-3e896db0beb4}AOS_Phys_chem.fields.{6862862b-7cbf-4b5d-be70-7944f6a23f5b}PhysicalState'] = "" ), true, false) ), a!gridRowLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: {"Boiling Point"} ) } ),
Discussion posts and replies are publicly visible
This may be occurring due to the direct [ ] indexing. Try Using the property or Index function.
Can you give me an example with the full code which I provided in my previous comment. Thank you!
To iterate each row, You have to use foreach before gridRowLayout like below.{ a!gridLayout( label: "Editable Grid", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Header Cell") }, rows: a!forEach( items: ri!tableFromRecord, expression: a!gridRowLayout( contents: { a!textField( value: property( fv!item, 'recordType!{c897e5ab-3e9a-4bd3-8bd0-4fcc5cd9882c}CT Table From Record.fields.{65173c83-afcb-405e-8d33-23ee406b1638}createdBy', null() ), saveInto: fv!item['recordType!{c897e5ab-3e9a-4bd3-8bd0-4fcc5cd9882c}CT Table From Record.fields.{65173c83-afcb-405e-8d33-23ee406b1638}createdBy'] ) } ) ), selectionSaveInto: {}, validations: {}, shadeAlternateRows: true )}
How do you have defined 15 items I don't see that anywhere? And how to hide some rows for example if anything is selected? This is something i need that's why each row was independent.
here in the below SS, I have defined the test value. & if you want to restrict the visibility of a row then you can configure showWhen parameter of gridRowLayour
But how do you hide for example row 13? when you use foreach items - 15 will always show 15 items. Thanks for the help!
Like this
So I can add even more rows to hide if I want? But the problem with that will be each of rows have different property which need to be specified...
As per your requirements, You can club multiple conditions on this.
Echoing others, I'm completely perplexed as to what you're attempting to do here. Why are you manually declaring multiple a!gridRowLayout() calls in your code? That's not a standard pattern for Editable Grids at all.
What would be the best way to save that when each row should be unique row and should have unique property. Somehow I need to initialize the rule input with already field out rows for the property. And at the same time i need to hide some of the rows based on what user have selected in another field.
The use case for an editable grid is, generally, multiple rows of the same property. As Stefan mentioned a few times before, this does not sound like the use case for a grid at all. Why not just have multiple fields that the user fills out?
Sounds good, but how do you save the multiple fields in same record?
Shwapx said:but how do you save the multiple fields in same record
add multiple fields to a form?
Yes, and then how do you save multiple things in the same column. You can see my record i and the grid i will have the user enter 15 times the value but for different property which need to be written as well in the property record. How do i specifically say to the rule input that the first value is for first property.. this is the reason grid is used.
Again, just manually add the field(s) you need to a section (etc). You are free to use whatever logic you need in order to relate them to each other. Nothing about this, at least as far as your example code above is structured, requires any sort of grid whatsoever - since you're not using the grid rows to each act on a different member of an array of data, but instead hardcoding each row to look at an individual property (which is unnecessarily difficult and adds unnecessary complexity). I guess it *can* work as an editable grid (after sorting out the issues with properly addressing data, etc), though I honestly can't see the benefit it provides you.On a side note: do you have a mock-up of any sort, for what you're hoping your form/grid to eventually look like? I honestly can't even tell.
The age-old advice in cases like this, is to learn to crawl before you try to run. You should step back and familiarize yourself with how editable grids work, overall, and in a bit simpler of a setup - as well as multi-field forms that don't have/use grids. Only after you understand these fundamendals intrinsically, should you be attempting what you're trying here.
You can see it here
So just 2 rows?
no 17 exactly the same just property is different. And based on selection of text field on top some of them hide.
Shwapx said:just property is different
I'm still not sure how to make sense of this. What is the "property"? How is it determined? Why does it require hardcoding completely separate grid rows, wherein most of the fields in each aren't actually editable at all as they don't point to source data and don't have a save target?
These are hardcoded properties for each request, they have to be hardcoded.. So once user let's say fill out first row in the records in the property filed they will see Melting Point and rest of the information.If I have separate record table for each property that means I need to have 17 tables linked.. which sounds insane.. So the property can be hardcoded visually for the user (read only) and then if they fill out unit with a!save to save the unit and also the property from that row that was the intention..
Shwapx said:they have to be hardcoded
Why?
Shwapx said:that means I need to have 17 tables linked
I'm pretty sure nobody's suggesting you break this out into 17 different tables.
Shwapx said:So the property can be hardcoded visually for the user (read only)
Why isn't the property stored in the array-row's data and displayed there, as opposed to hardcoding 17 separate GridRows? Something is very much not making sense with your implementation.