I have a Json expression stored in one column in the database. I'm looking to separate/parse out the data to display in multiple columns. Some help Please!
Example is below:
"{\"TransactionHeader\":
{\"BinNumber\":\"000000\",
\"Version\":\"D0\",
\"TransactionCode\":\"B1\",
\"ProcessorControl\":\"PBMICCCE\",
\"TransactionCount\":\"01\",
\"ServiceProviderQualifier\":\"07\",
\"ServiceProviderId\":000000,
\"DateOfService\":\"2/20/1701\",
\"VendorId\":\"\"
},
\"Insurance\":
}"
Related
I want to display data from SQL Server where the data is in JSON format. But when the select process, the data does not appear:
id
item_pieces_list
0
[{"id":2,"satuan":"BOX","isi":1,"aktif":true},{"id":4,"satuan":"BOX10","isi":1,"aktif":true}]
1
[{"id":0,"satuan":"AMPUL","isi":1,"aktif":"true"},{"id":4,"satuan":"BOX10","isi":5,"aktif":true}]
I've written a query like this, but nothing appears. Can anyone help?
Query :
SELECT id, JSON_Value(item_pieces_list, '$.satuan') AS Name
FROM [cisea.bamedika.co.id-hisys].dbo.medicine_alkes AS medicalkes
Your Path is wrong. Your JSON is an array, and you are trying to retrieve it as a flat object
SELECT id, JSON_Value(item_pieces_list,'$[0].satuan') AS Name
FROM [cisea.bamedika.co.id-hisys].dbo.medicine_alkes
Only in the case of data without the [] (array sign) you could use your original query '$.satuan', but since you are using an array I change it to retrieve only the first element in the array '$[0].satuan'
I have a source table which just has one row:
So i stored the value from Values_per_Country into a parameter:
I want to use this parameter into my SELECT transformation(schema modifier),
but this error comes up:
Is there a way around this,so i can use values from the source tables?
You can create a Lookup activity to get the column values of source table. And then pass to the parameter in Data Flow. Finally, your expression type == 'double' && position > 0 && position <= $parameter3 will work.
Screenshot:
Expression in the below image: #activity('Lookup1').output.firstRow['Values_per_Country']
I have input fixed width txt file as source.
test file sample below
column_1
12ABC3455
13XYZ5678
How to build dynamic column pattern to produce derived columns.
column Name : empId -> substring(column_1,1,2)
derive Column setting
I can hardcode the empid in & substring(column_1,1,2) in expression.
but i need to make it dynamic with the JSON input to derive dynamic derived columns with column pattern.
Below sample JSON input parameter.
My input JSON formatted parameter
[
{
"colname": "empid",
"startpos": 1,
"length": 2
},
{
"colname": "empname",
"startpos": 3,
"length": 3
},
{
"colname": "empSal",
"startpos": 6,
"length": 4
}
]
help me to build the column pattern with the json input
I tested many times and can't achieve that.
Just per my experience, I'm afraid to tell you that it's impossible to to that in Data Factory actives or Data Flow with json parameter.
I have a table that looks like this:
[type] [localid] [data] [executed by]
in the data column there is json
{
"type":"music",
"local_id":"00000086",
"recording":{
"album":null,
"title":"null",
"local_id":"OUHA_A46013SG0001",
"composers":[
"null"
],
"label_name":"null",
"main_artist":"null",
"production_country":null
},
"starts_at":null,
"parallel_hash":"8fe1dfd71f8c19be83806455d5194532",
"report_id":"6bd9e074-5f38-402f-a706-7916def5a9e1",
"duration_in_seconds":120.4
}
i am able to retrive all information into a column for every information except i cannot seperate the information in the recording {}.
I have used select data::json->>'type' as type, and so on... and have got the info
[type][localid][recording][starts_at][report_id][duration_in_seconds]
but i also want the information seperated in the recording data. so that the result is
[type][local_id][recording_album][recording_title][recording_local_id][recording_composers][recording_label_name][recording_main_artist][recording_production_country][starts_at][parallel_hash][report_id][duration_in_seconds]
Can anyone show me how?
Found it out using this....
data::json->'recording'->>'album' as album,
data::json->'recording'->>'title' as title,
and so on
A table in database have two column: ID and Value
In my project there are another data in a dictionary that key is ID and value is Value.
I want to get difference: Data that are in the dictionary and are not in the database. If these both data were in database, I could use SQL commands "Except" or "Not Exist" to get the difference like below image.
What is the best way to do this?
I use SQLiteDB that the result of query is a dictionary like this:
[["ID":"id1", "Value": "val1"], ["ID":"id2", "Value": "val2"],...]
Also notice that both columns should be considered while compare these two data (dictionary and data in db).
// here we get intersection of new data and data we have
let intersection = dataSet1.filtered { data in dataSet2.contains(where: { $0.id == data.id })}
// delete elements from dataSet1 which belongs to intersection
let dataSet1MinusDataSet2 = dataSet1.filter { data in intersection.contains(where: { data.id == $0.id })}
I've written code here without any Xcode so errors in syntax is possible but I think you will get the idea