Hi,
I have written the following code where sampleData is a DataStore entity, but I am not getting any data in the front end:
rows: a!forEach( items: ri!sampleData, expression: a!gridRowLayout( contents: { a!textField( value: ri!sampleData.Account, saveInto: fv!item.Account, readOnly: true ), a!textField( value: fv!item.jan, saveInto: fv!item.jan ), a!textField( value: fv!item.feb, saveInto: fv!item.feb ), a!textField( value: fv!item.mar, saveInto: fv!item.mar ) } ) ),
But when I open the front end I see the following table:
What should I do so that the front end shows the data?
Discussion posts and replies are publicly visible
Hi Karanc,
What are you passing as an input (ri!sampleData)?Also please note that your first textField can only contain a reference to value since it's a readOnly field (see below). I advise you to take a look at the following recipe since it's quite close to what you are trying to do docs.appian.com/.../recipe-add-edit-and-remove-data-in-an-inline-editable-grid.html
a!textField( value: fv!item.Account, readOnly: true )
Hi pedro,
I have created the rule input name sampleData which is a DataStore entity.
Can rule Input store Datatypes? If yes, can you please elaborate a bit on what do you mean sampleDate as input? And how to proceed further for loading the data in the editable grid.
And I am using readonly, because I want that users can't change some fields, but that is okay. I can remove that and work on it later.
Karen,
Rule Inputs can be associated to several Appian Data Types including any CDT that you might have created. See the following link on how you can use a queryEntity with a cast to a particular CDT (https://docs.appian.com/suite/help/20.3/Query_Recipes.html#retrieve-the-data-for-all-fields).
The code that you previously had for the readOnly field would probably generate an error or erroneous behavior. Please consider my previous observation
Hi Pedro,
I have written an expression rule name Add_Budget and I am trying to refer to that for data extraction, still, I am not getting any rows in the front end. The modified code is belows:
rows: a!forEach( items: ri!sampleData, expression: a!gridRowLayout( contents: { a!textField( value: rule!Add_budget().Account, saveInto: fv!item.Account, ), a!textField( value: rule!Add_budget().Jan, saveInto: fv!item.Jan ), a!textField( value: rule!Add_budget().Feb, saveInto: fv!item.Feb ), a!textField( value: rule!Add_budget().Mar, saveInto: fv!item.Mar ) } ) )
Here the rule Add_budget is an express rule, I have even tried to use just the a!queryEntity to extract the data but nothing seems to work.
Can you please elaborate on the steps like what should be done?
Karan,
I must admit that I am a bit confused on what you are trying to achieve. Some thoughts that I hope will help you:
Hope this helps,
Pedro
Sorry for the trouble.
I read the documentation about appian adding, removing data from the editable grid. It seems like my initial code was quite similar to that, still, I am unable to fetch the data from the backend.
Do I need to create a process model so that the rule Input Sample data can get data from the backend? Or just creating a rule input that contains a Data Store as its type is okay.
That depends on how and where you want to use that interface. I suggest you passing as an input the type (CDT) that will be used in the grid. Once you decide on that, you just need to ensure that you're passing the correct type everywhere you use that interface.
Assuming that "get data from the backend" means getting data from a database, you can create a rule input that will retrieve the data that you want (using queryEntity), cast that data to the proper CDT and then you can reference that rule where you call your interface. Something like this:
rule!interface(sampleData:rule!GetDataForInterface())
Pedro,
I am able to extract data from the rule input with the command rule!Add_budget().Jan[0] (Here Add_budget is an expression rule), but how to show the same in the editable grid. And also I can't use the index 1 for every row.
I can't figure out why the code is not working in the editable grid, while I am able to extract the data.
Please shed some more light on what you're trying to do. Is it to change a set of items and update them in the database? Also please share your rules definitions and code
I want to extract the data from the database in an editable grid so that I add data or update the existing data.Steps taken for this:
1. Created a DataType, which corresponds to the target table in the database
2. Added DataType in DataStore
3. Created a constant of the DataType
4. In the interface created a rule input (sampleData) which is DataStore
5. Create an editable grid which shows the data (Stuck Here)
Experiments:
1. Try to create expression rule name (Add_budget)
2. Try creating a process model
Hopefully this helps