Hello All,
We have a requirement to use the service backed record and have to use store procedure for the data. We made a parent rule to call the store procedure.
rule!parent:-{
with( local!response: rule!storeProcedureRule(ri!User), local!data: local!response.result, a!dataSubset( data: local!data, identifiers: index(local!data, "fieldA", {}), totalCount: count(local!response.result.data), startIndex: 1, batchSize: 100, sort: {a!sortInfo(field:"fieldA",ascending:true)} ))}
rule!storeProcedureRule:-
{
executestoredprocedure( dataSourceName: cons!ABC procedureName: cons!abc, inputs: { { name: "User", value: ri!User } })}.
when we are opening record . The below error we are getting
The Requested Record Type Is Not Available(APNX-1-4198-000).
and when we are opening Edit Record List it is showing error:-Error Evaluating UI Expression.
Thanks in advance.
Discussion posts and replies are publicly visible
Yes,
You need to cast the stored procedure result, you can use foreach
foreach( items:local!data, expression: type!YOUR_CDT( COL1:fv!item.COL_1, COL2:fv!item.COL_2 ) )
Iterating in this manner is incredibly inefficient!
You'd be better off having a CDT with fields that actually match the return from the stored procedure (or changing the return names for the stored procedure to match the CDT) and then using cast to cast the whole result to a type of list of cdt:
cast( typeof( { type!YOUR_CDT() } ), local!data )