mrfazolka
mrfazolka

Reputation: 790

Intersystems cache db - specific ROWSPEC dynamically

I can do this:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Title:%String,Author:%String")
{
}

But I need to specify ROWSPEC dynamically. I have globals like this:

^glob("title1","author1","xxKZ1") = "val1"
^glob("title1","author1","ssn","xyPO2") = "val2"
^glob("title2","author2","xxII8") = "val3"

^globNext("key1") = "val1"
^globNext("key1","key2") = "val2"

So I need to dynamically create structure of query row. For ^glob I need have something like this:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Prop1:%String, Prop2:%String, Prop3:%String, Prop4:%String, Val:%String")
    {
    }

For ^globNext I need something like:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Prop1:%String, Prop2:%String)
    {
    }

Is it possible to reach it?

Upvotes: 0

Views: 104

Answers (1)

DAiMor
DAiMor

Reputation: 3205

No, it is not possible, because number of columns have to be fixed. But as your code generate result, you can define some columns like Prop1, Prop2...PropN, and in result return as many columns as you need, and any last columns just well be null. And after that in your client-side code you cant get access by its like Value.

Upvotes: 2

Related Questions