Hello there,
I am querying a remote PB server by doing a POST to its REST url (something like
). The query is contained in a JSON file which looks like this
For human readable version, this is the YAML equivalent:
The reason I am using this approach is that I am on an OS which is not supported by the PB desktop (Linux, I know it may sound like the devil's work to you people but that's what I have).
which does not work because there is something wrong with my syntax. Generally, this method works for other JSON-like queries. What I am trying to do here is to experiment with a working example and see my mileage. And I like this method of editing my JSON (or YAML) and doing a POST using
from the command line, which then I can program into my scripts and automate the procedure while I am having some holidays, presto!
So, the immediate question is how to query a table and return all columns based on some WHERE/LIKE condition? Is this like SQL? The Select looks like but the WHERE I can't get it to LIKE!
Secondly, is there any documentation for what I am trying to do? What is the name of the JSON content? I have read about DAX and command-lets but that does not remotely look like it although it is supposed to do the same thing.
Many thanks,
b.
I am querying a remote PB server by doing a POST to its REST url (something like
Code:
https://XYZ/public/reports/querydata
Code:
{
"queries" : [
{
"ApplicationContext" : {
"Sources" : [
{
"ReportId" : "ZZZ"
}
],
"DatasetId" : "YYY"
},
"Query" : {
"Commands" : [
{
"SemanticQueryDataShapeCommand" : {
"Query" : {
"Where" : [
{
"Condition" : {
"In" : {
"Values" : [
[
{
"Like" : {
"Value" : "'%abc%'"
}
}
],
null
],
"Expressions" : [
{
"Column" : {
"Property" : "APROPERTY",
"Expression" : {
"SourceRef" : {
"Source" : "A"
}
}
}
}
]
}
}
}
],
"Select" : [
{
"Name" : "AVIEW.APROPERTY",
"Column" : {
"Expression" : {
"SourceRef" : {
"Source" : "A"
}
},
"Property" : "APROPERTY"
}
}
],
"Version" : "2",
"From" : [
{
"Name" : "A",
"Entity" : "AVIEW"
}
]
},
"Binding" : {
"Primary" : {
"Groupings" : [
{
"Projections" : [
"0",
"1"
]
}
]
},
"Version" : "1",
"DataReduction" : {
"DataVolume" : "3",
"Primary" : {
"Top" : {}
}
}
}
}
}
]
},
"QueryId" : ""
}
],
"cancelQueries" : [],
"modelId" : "XXX",
"version" : "1.0.0"
}
For human readable version, this is the YAML equivalent:
Code:
---
cancelQueries: []
modelId: XXX
queries:
- ApplicationContext:
DatasetId: YYY
Sources:
- ReportId: ZZZ
Query:
Commands:
- SemanticQueryDataShapeCommand:
Binding:
DataReduction:
DataVolume: 3
Primary:
Top: {}
Primary:
Groupings:
- Projections:
- 0
- 1
Version: 1
Query:
From:
- Entity: AVIEW
Name: A
Select:
- Column:
Expression:
SourceRef:
Source: A
Property: APROPERTY
Name: AVIEW.APROPERTY
Version: 2
Where:
- Condition:
In:
Expressions:
- Column:
Expression:
SourceRef:
Source: A
Property: APROPERTY
Values:
-
- Like:
Value: "'%abc%'"
-
QueryId: ''
version: 1.0.0
The reason I am using this approach is that I am on an OS which is not supported by the PB desktop (Linux, I know it may sound like the devil's work to you people but that's what I have).
which does not work because there is something wrong with my syntax. Generally, this method works for other JSON-like queries. What I am trying to do here is to experiment with a working example and see my mileage. And I like this method of editing my JSON (or YAML) and doing a POST using
Code:
curl
So, the immediate question is how to query a table and return all columns based on some WHERE/LIKE condition? Is this like SQL? The Select looks like but the WHERE I can't get it to LIKE!
Secondly, is there any documentation for what I am trying to do? What is the name of the JSON content? I have read about DAX and command-lets but that does not remotely look like it although it is supposed to do the same thing.
Many thanks,
b.