I have a functional query rule that returns the datasubset I am interested in. W

I have a functional query rule that returns the datasubset I am interested in. With the data from that data subset I would like to populate a CDT. Is there a way to convert the data section of a datasubset into a CDT? The syntax I am trying to use:

a!save(ri!CDT_dataWeNeed,fn!index(rule!Database_getData(),"data",""))

The reason I am trying to do this is because I would like to use dot notation to move data from a database with datastore to nested CDTs to create an XML message.

OriginalPostID-164186

OriginalPostID-164186

  Discussion posts and replies are publicly visible

Parents
  • @philb I guess we can eliminate looping in case of arrays being returned by rule by changing the way we type cast:

    cast(
    typeof(
    {'type!CDT_YouNeed'()}
    ),
    fn!index(rule!Database_getData(),"data",""))

    I tried this approach many times in case of a multiple cdts being returned from datasubset and it worked absolutely fine. Further I also used the same approach to flatten the data sets that were returned from multiple queries.

    To the best of my knowledge, it depends on how we type cast the data, i.e. if it is single, use 'type!CDT_YouNeed'(), and if it is multiple, use {'type!CDT_YouNeed'()}. Please do let me know I missing something.
Reply
  • @philb I guess we can eliminate looping in case of arrays being returned by rule by changing the way we type cast:

    cast(
    typeof(
    {'type!CDT_YouNeed'()}
    ),
    fn!index(rule!Database_getData(),"data",""))

    I tried this approach many times in case of a multiple cdts being returned from datasubset and it worked absolutely fine. Further I also used the same approach to flatten the data sets that were returned from multiple queries.

    To the best of my knowledge, it depends on how we type cast the data, i.e. if it is single, use 'type!CDT_YouNeed'(), and if it is multiple, use {'type!CDT_YouNeed'()}. Please do let me know I missing something.
Children
No Data