Here is my code.
And then result.
You can download code here. ( For anyone who get errors just install web ui package to it )
for_testing.xlsx (8.9 KB)
Sequence6.xaml (9.6 KB)
For the question i need you know how can i create a new node with data by using this data?
Example i need to create a new one node key as “Column3” and value as “xxx”
I expect result will be like this
Big thank if have and example of code for me.
there are a few options
myDT | DataType: DataTable =
add to the datatable the new rows and col values then bring it back to a JArray
- Create a new JObject with its properties and values
- Use the ADD method (Invoke Method Activity) from Newtonsoft.Json.Linq.Jarray class and add the above created JOBject
I don’t get it. Example please if don’t bother you much, Thanks.
Follow the steps
- Convert the jarray to datatable using assign activity with
dt = varJarray.ToObject(Of DataTable)
- Use add data column activity and add a new column Column3
- Then populate the values …as I see all the 3 values are similar say if you want to add xxx only as value for all roes then use assign with
dt.Columns("Column3").Expression = "'xxx'"
- Now you need to convert the datatable to jarray again using the same serialize and deserialize steps you used above in your code after read range
Ideally as per your code …you can start from step 2 as you are reading datatable from excel anyways and can add the column after that immediately and populte it
Thank you for replying I think this a work around solutions for solve the problem however I think I should to wait might be anyone have a good solution for this posted thank you.
You wanted to add new jobject…then this is the way…this is not a work around…not sure why you think this is a work around as such
The aim is to maintain structure and add data to json array as needed
If you are looking for anything specific please do specify so that we can help
My point is might by have an other way to do it that why the posted still opening.
For specific I’m not sure that is the best way to do as you reply
For make it clear , imaging if i have many step to do this and many sequence to do too.
My point is if I follow you step it working 100% but inconvenient for using it.
The concept is simple and maybe is one solution for anyone who got this problem same as me.
By the way I think about another thing that I’m looking for example in programming when your datatype is ready (in case example is ARRAY) then If I need to adding new index new key new value it easy to do
Example PHP language
then i think when sometime in process in need to adding a new node in JArray maybe it just and new
Assign Activities and then perfectly what i want
If maybe another way is using benefit of invoke code imagine now JArray in my program is ready
so i just need add a new node my friend it should be the easy way to make it.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.