Hi,
I'm trying to access a RecordType I've created in an interface.
To do this, I've created my Gridfield and added all the RecordType columns. I did the same with index.Now, that the grid is well displayed, is there any way to set the value of default filters or user filters?
or enable/disable one of them please?
I find it hard to imagine that my RecordType grid can be filtered only by a manual user action... I hope not.
Any help would be greatly appreciated.
Regards
Discussion posts and replies are publicly visible
Hi ,
You can start with the below link : (assuming it's 20.3 version)
Thank you,
Yes I can add/remove a user filter, and then use the "Manage my filters" functionalityy to save a default filter value... but i don't see any way to set a default value filter programatically (without using "Manage my filters") of a Recordtype based GridField.
Maybe could you send me a code example if you succeeded to do it ?
Does this help you?
docs.appian.com/.../Create_a_Record_Type.html
Thank you Stefan, but no.It does not reply to my question, to be abble to dynamically (with code) set a value of a default value filter (of the RecordType), from inside my interface that defines a gridfield based on this RecordType.
Hm ... for a given user filter, you can define a default (Meaning: This option is selected when the user navigates to this UI) which is expressionable.
I am not sure whether I completely understand what you want to achieve.
For example, I've created a Contracts RecordType with default filter "contract_code".Now I open my Interface (where I've created a GridField based on the RecordType), and then I would like to set a default value for a user filter, something like this :
(but I do not want to manually interact with the RecordType)
a!gridField { data: recordType!RR_Contract, columns : { ... }, userFilters: { recordType!RR_Contracts.filters.contractCode recordType!RR_Contracts.filters.contractCode.defaultValue = "00000002" or : filter: filter( field: "contract_code", operator: "=", value: "00000002" ... }
OK. Did you try to set up these filters in the record itself where you can define a default value?
Yes, these filters are already set up in the Recordtype it self.But this code instruction is not accepted (I've invented it to give you an example of what I need ;-) ) :recordType!RR_Contracts.filters.contractCode.defaultValue = "00000002"
And how about this ....
Thank you Stefan, but once again... I need to do it programmatically... not from or inside the RecordType Interface.In your example, you set "Default value" = "One"but how to do, if I need to put "Default value" = "Two" without touching the RecordType ?
It's only possible to define the default value for a user filter in the record type - it's not possible to define this on the fly when referencing the user filter in a grid. Granted, the default option in the record type can accept an expression, so you could create some more advanced logic if you'd like.
I also can't quite tell based on the discussion above though: do you need to define a default value for the user filter or just apply a filter to the grid without the user being able to change it? If it's the latter, you can define a filter in the data source using the a!recordData() function like this:
a!gridField( label: "Read-only Grid", labelPosition: "ABOVE", data: a!recordData( recordType: 'recordType!{ccd1a746-9707-4f92-b9d7-0d83c6ff7854}Customer', filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{ccd1a746-9707-4f92-b9d7-0d83c6ff7854}Customer.fields.{status}status', operator: "=", value: "Open" ) }, ignoreFiltersWithEmptyValues: true ) ), columns: {...} )
Thanks a lot Peter, it is exactly what I was looking for.I'm sure this will help, as my grid has to be dynamically filtered from others sources (like another grid or specific values that can be dynamic)