zerocode
zerocode copied to clipboard
Parameterized csvSource with body payload from reusable external JSON file
From Slack: @Dorian
Hello, is it possible to use csv data in a reused son?
Because the ${0} like variables in the file aren't getting swapped with the values from the csv.
...
"body": "${JSON.FILE:notification-api/parameterizable_body_pos_csv.json}"
...
"parameterized": {
"csvSource": [
"Amelia, Loska, 1969-02-06, female, Im Grunde 082, Thörnich, 54340",
"Pauline, Brand, 1967-01-29, female, Schöneberger Str. 71, Strande, 24229"
]
}
This looks like anew feature request which needs to be implemented.
Please recheck the behavior before implementing it.
Current:
Inline CSV data in the "parameterized" block work fine
Desired: CSV data from external source should work in similar fashion.
AC Details
From the perspective of the changes, the following is a better way. e.g. Currently, it works this way.
"parameterized": {
"csvSource":[
"octocat, The Octocat, San Francisco, 583231",
"siddhagalaxy, Sidd, UK, 33847730"
]
}
What should be ideal is to source this from a CSV file e.g.
"parameterized": {
"csvSource":"${CSV.FILE:my_data/params.csv}"
}
where the params.csv content will be e.g.
user,name,city,userid
octocat,The Octocat,San Francisco,583231
siddhagalaxy,Sidd,UK,33847730
The 1st line is the header which can be ignored while reading.
I would like to help but am totally new to this project. Can you please elaborate more on this?
@pradeeppg89, thanks. Updated the description section. Let us know if you are able to reproduce the issue!
@pradeeppg89, are you still looking into this?
Hi @authorjapps I'm trying to understand the above issue and I understood that something like the below might be required.
"parameterized": {
"csvFileSource": {
test.json
}
}
Now the csvFileSource can also be a list. I'm more or less sure that the above is wrong. Could you please correct my understanding here.
Also I'm a little unclear on the reused son part. Can we please have a chat regarding this on Slack
@Sauhardstark I think this is something I believe, should be reproduced as explained in the issue description. From the changes perspective, the following is better way. e.g. Currently, it works this way.
"parameterized": {
"csvSource":[
"octocat, The Octocat, San Francisco, 583231",
"siddhagalaxy, Sidd, UK, 33847730"
]
}
What should be ideal is to source this from a CSV file e.g.
"parameterized": {
"csvSource":"${CSV.FILE:my_data/params.csv}"
}
where the params.csv content will be e.g.
user,name,city,userid
octocat,The Octocat,San Francisco,583231
siddhagalaxy,Sidd,UK,33847730
The 1st line is the header which can be ignored while reading.
Hi @authorjapps Is this issue fixed? if not I would like to try solving this
Hello @authorjapps I have raised a PR for this, can you please let me know if the PR is as per the expectation? Also is it OK to assign this to me?
Hello @imprashant , Apologies for the delay as we were slightly busy in our day jobs. We will take a look soon.
This would be a cool feature to have, really.
Similar requirement has been requested in https://github.com/authorjapps/zerocode-hello-world/issues/29 as well. Parameterization of external files will be important feature that could solve multiple challenges.
PR merged.
This feature is available in 1.3.36 (and higher version) when release.