Only articles that contain the EmailMarketing tag are needed.
I'm probably doing the wrong search on the tag, since it's an array of values, not a single object, but I don't know how to do it right, I'm just learning graphql. Any help would be appreciated
query:
query {
enArticles {
title
previewText
tags(where: {name: "EmailMarketing"}){
name
}
}
}
result:
{
"data": {
"enArticles": [
{
"title": "title1",
"previewText": "previewText1",
"tags": [
{
"name": "EmailMarketing"
},
{
"name": "Personalization"
},
{
"name": "Advertising_campaign"
}
]
},
{
"title": "title2",
"previewText": "previewText2",
"tags": [
{
"name": "Marketing_strategy"
},
{
"name": "Marketing"
},
{
"name": "Marketing_campaign"
}
]
},
{
"title": "article 12",
"previewText": "article12",
"tags": []
}
]
}
}
I believe you first need to have coded an equality operator within your GraphQL schema. There's a good explanation of that here.
Once you add an equality operator - say, for example _eq - you can use it something like this:
query {
enArticles {
title
previewText
tags(where: {name: {_eq: "EmailMarketing"}}){
name
}
}
}
Specifically, you would need to create a filter and resolver.
The example here may help.
{
"id": "1",
"name": ""
"parts": [
{
"name": "partname1",
"description": "description 1"
"messages": [
{
"text": "text 1"
"sender": "sender 1"
}
]
},
{
"name": "partname2",
"description": "description 1"
"messages": [
{
"text": "text 2"
"sender": "sender 2"
}
]
}
]
}
Based on this: https://angular.io/guide/reactive-forms
Using this code:
setParts(parts) {
const partsFormGroup= parts.map(part => this.fb.group(part));
const partsFormArray = this.fb.array(partsFormGroup);
this.myForm.setControl('parts', partsFormArray);
}
patchValue works fine for parts properties: name & description.
How to patchValue to messages?
I am getting this error:
ERROR TypeError: this.validator is not a function
I want create ValueSet with link to my CodeSystem.
ValueSet expantion with enclosed contains should be like:
{
...
"expansion": {
"parameter": [
{
"name": "total",
"valueString": "282"
}
],
"contains": [
{
"code": "0",
"display": "asd",
"contains": [
{
"code": "High"
},
{
"code": "Okso",
"display": "1"
}
]
}
]
}
...
}
I tried to create CodeSystem with hierarchical concepts, and ValueSet with compose.include to my CodeSystem. But i getted expantion with 1 level contents like this:
"contains": [
{
"code": "0",
"display": "asd"
}, {
"code": "High"
}, {
"code": "Okso",
"display": "1"
}
]
I tried change different attributes CodeSystem, but this bring me no result.
Help me please with a simple example!
I am unable to connect using artillery.io with setting engine = socketio, please find my configuration json below
socket error {"type":"Transport error", "description":400}
"scenarios": [
{
"name": "my test",
"engine": "socketio",
"flow": [
{
"emit": {
"channel": "command",
"namespace": "command"
}
},
{
"think": 1
}
]
}
]
"scenarios": [
{
"name": "my test",
"engine": "socketio",
"flow": [
{
"emit": {
"channel": "command"
"data": "hello"
"namespace": "/command"
}
},
{
"think": 1
}
]
}
]
Please try using above command
Have a Json out put like
{
"query": {
"results": {
"industry": [
{
"id": "112",
"name": "Agricultural Chemicals",
"company": [
{
"name": "Adarsh Plant",
"symbol": "ADARSHPL"
},
{
"name": "Agrium Inc",
"symbol": "AGU"
}
},
]
{
"id": "914",
"name": "Water Utilities",
"company": [
{
"name": "Acque Potabili",
"symbol": "ACP"
},
{
"name": "Water Resources Group",
"symbol": "WRG"
}
]
}
]
}
}
}
Need the out put like - Company Name, Company Symbol, Company id,
Company id name
and example of output would be
Adarsh Plant, ADARSHPL, 112, Agricultural Chemicals
Agrium Inc, AGU, 112, Agricultural Chemicals
Acque Potabili, ACP, 914, Water Utilities
Water Resources Group, WRG, 914, Water Utilities
Any suggestions
There's a typo in your sample json, but we'll talk about it later.
Assuming your json data converted to hash object already like this:
json={
"query"=> {
"results"=> {
"industry"=> [
{
"id"=> "112",
"name"=> "Agricultural Chemicals",
"company"=> [
{
"name"=> "Adarsh Plant",
"symbol"=> "ADARSHPL"
},
{
"name"=> "Agrium Inc",
"symbol"=> "AGU"
}
]
},
{
"id"=> "914",
"name"=> "Water Utilities",
"company"=> [
{
"name"=> "Acque Potabili",
"symbol"=> "ACP"
},
{
"name"=> "Water Resources Group",
"symbol"=> "WRG"
}
]
}
]
}
}
}
You can use inject and map to handle the two level array of industry, inject will iterate the outer array:
json["query"]["results"]["industry"].inject([]){|m,o|
m += o["company"].map{|x| [x["name"],x["symbol"],o["id"],o["name"]]}
}
result is an array of arrays with the order as you wish:
=> [["Adarsh Plant", "ADARSHPL", "112", "Agricultural Chemicals"],
["Agrium Inc", "AGU", "112", "Agricultural Chemicals"],
["Acque Potabili", "ACP", "914", "Water Utilities"],
["Water Resources Group", "WRG", "914", "Water Utilities"]]
If you want get a string delimited by comma, you could chain on .flatten.join(",") at the end.
json["query"]["results"]["industry"].inject([]){|m,o|
m += o["company"].map{|x| [x["name"],x["symbol"],o["id"],o["name"]]}
}.flatten.join(",")
Result:
=> Adarsh Plant,ADARSHPL,112,Agricultural Chemicals,Agrium Inc,AGU,112,Agricultural Chemicals,Acque Potabili,ACP,914,Water Utilities,Water Resources Group,WRG,914,Water Utilities
The typo of your json data:
In the middle }, ] { should be changed to ] },{ .
Convert json to hash
https://stackoverflow.com/a/7964378/3630826