Hi Everyone,
I am querying the db table through query record type. This query gives the list of db records. When I am using this in interface and using index to get the particular field, it gives this list of particular field. In case of null or single it also gives list. Can anyone please help me when it is null or single value should not give list.
Discussion posts and replies are publicly visible
Please share the code snippet of both your query rule and the interface.
Below query I am using for diffrent record types
a!localVariables( local!data: a!queryRecordType( recordType: "recordType!HM Patient", fields: ri!selectionField, filters: a!queryLogicalExpression( logicalExpressions: ri!logicalExpression, operator: "AND", filters: { a!queryFilter( field: "recordType!HM Patient.fields.patientIdPk_int", operator: "=", value: ri!patientIdPk_int ), a!queryFilter( field: "recordType!HM Patient.fields.genderId_int", operator: "=", value: ri!genderId_int ), ri!filters }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!defaultValue( value: ri!pagingInfo, default: a!pagingInfo( startIndex: 1, batchSize: 50, sort: { a!sortInfo( field: "recordType!HM Patient.fields.patientIdPk_int", ascending: false() ) } ) ), fetchTotalCount: or(ri!fetchTotalCount_bool) ), if( or(ri!returnDataSubset_bool), local!data, index(local!data, "data", {}) ) )
let me know if my earlier reply (below) makes any sense. it looks like this is a standard use case, though it'll depend on exactly what the context is in which you want to force the returned value to not snow up as a list.
Are you trying to say, when you are passing certain fields into the ri!selectionField you get some list and when you don't pass you are still getting the list?If so, That is how it works. I still do not understand your question to be frank.
Konduru Chaitanya said:That is how it works. I still do not understand your question
He's saying (unless i'm sorely mistaken) that there are some conditions in which a query will return one entry and some in which it returns zero entries, and is confused that the output is still "list type". Hence my explanation below of how to manually handle this when necessary.
Okay, got it!