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
  • There is another silghtly longer-winded way of doing this that supports arrays of data returned by the rule - it might not fit your use case but here it is anyway:

    with(
              local!data: rule!Database_getData(),
              apply(
                        type!CDT_dataWeNeed(
                                  _,
                                  _,
                                  _
                        ),
                        merge(
                                  index(local!data, "id", {}),
                                  index(local!data, "dataField1", {}),
                                  index(local!data, "dataField2", {})
                        )
              )
    )
Reply
  • There is another silghtly longer-winded way of doing this that supports arrays of data returned by the rule - it might not fit your use case but here it is anyway:

    with(
              local!data: rule!Database_getData(),
              apply(
                        type!CDT_dataWeNeed(
                                  _,
                                  _,
                                  _
                        ),
                        merge(
                                  index(local!data, "id", {}),
                                  index(local!data, "dataField1", {}),
                                  index(local!data, "dataField2", {})
                        )
              )
    )
Children
No Data