Package Run SQL Script -> Pass output to variable

More
2 years 3 months ago - 1 year 4 months ago #24055 by admin
To make life of all our customers easier we have added an example to our wiki

Here is the link

www.etl-tools.com/wiki/advanced-etl-proc...et-variables-action/

I hope you will find it useful

Mike
ETL Architect
Last edit: 1 year 4 months ago by admin.

Please Log in or Create an account to join the conversation.

More
2 years 3 months ago - 1 year 4 months ago #24056 by prashant

www.etl-tools.com/wiki/advanced-etl-proc...et-variables-action/

 
Thank you for taking time to put this together , will test this and update you. 
Last edit: 1 year 4 months ago by admin.

Please Log in or Create an account to join the conversation.

More
2 years 3 months ago #24067 by prashant
HI ,
It's working ! 

For others , who will look at this post , please see how to use parameters inside the query as an example. IN screenshot, in query we are defining the parameter we will use <id>
select '<json_variable>' as variable_name, text_field_02 as variable_value from event_log where id ='<id>'



Notice 2XSet Variables? 1st one is where we pass the <id> value 

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #24140 by prashant
Hellos,
When I run the script via command line  , package works but I get below message

Information     04-08-2024 16:03:38     Using Following Sql: SELECT '<json_variable>' AS variable_name,  text_field_02 AS variable_value FROM event_log WHERE id = '561b2923-dcea-4e61-8156-ca02eb659ab6'; Error   04-08-2024 16:03:38     Calculation Failed:

{   "{{mobile}}": "0912563",   "{{candidate_id}}": "372",   "{{candidate_name}}": "Tanvi Musk",   "{{candidate_position}}": "HR manager",   "{{candidate_ctc}}": "540000",   "{{join_date}}": "2024-05-08",   "{{candidate_address}}": "shivaji chowk aavas bhuvan ghatkopar east",   "{{join_company}}": "Firkee Accessories Pvt Ltd",   "{{appointment_id}}": "00008",   "{{company_address}}": "A1 Unit 148, First Floor, Shah",   "{{company_logo}}": "firkee_logo.png",   "{{letter_type}}": "04-Appointment Letter" }

Error   04-08-2024 16:03:38     Following Error happened: Expression expected but '"' found
 

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #24141 by admin
Perhaps json is not valid?

Or you have to adapt the script. 

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #24142 by prashant

Perhaps json is not valid?
 
that's the first thing I thought ,I verified the json , it's completely fine. 

I tried to check the validity of the JSON
Code:
SELECT '<json_variable>' AS variable_name,        text_field_02 AS variable_value,        CASE             WHEN ISJSON(CAST(text_field_02 AS VARCHAR(MAX))) = 1 THEN 'Valid JSON'            ELSE 'Invalid JSON'        END AS json_validation FROM event_log WHERE id = '561b2923-dcea-4e61-8156-ca02eb659ab6'; 

I also tried removing the {{ }} from the JSONs variable name
Code:
{   "mobile": "09933234",   "candidate_id": "372",   "candidate_name": "Tanvi Musk",   "candidate_position": "HR manager",   "candidate_ctc": "540000",   "join_date": "2024-05-08",   "candidate_address": "shivaji chowk aavas bhuvan ghatkopar east",   "join_company": "Firkee Accessories Pvt Ltd",   "appointment_id": "00008",   "company_address": "A1 Unit 148, First Floor, Shah",   "company_logo": "firkee_logo.png",   "letter_type": "04-Appointment Letter" }
 


Again everything works , but I can't understand the error 

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save