hello ,
i m fetching data from a api and now i want to write the data in the csv but it is throwing me an error that input array is longer than the number of columns in this table .
i am also attaching my flow for the reference
Main.xaml (11.3 KB)
can any one help ,
Regards
Hi @Raina_Ocean_Sanjay ,
Could you Debug the workflow and Check the value that you are adding to the row and the number of Columns in the Datatable to which you want to add ?
The value/array contains more than the number of columns, hence the error.
You Could check the value in Immediate Panel after Debug and send us a Screenshot.
Yoichi
(Yoichi)
September 16, 2022, 7:30am
3
Hi,
First, “data” in ForEach isnt’t good, because its same as data class and is caused trouble.
Next, there are 4 columns in the datatable, but 9 items in the JToken. So you need to create datatable which has 9 columns.
I just modified them as the following. Can you try this?
Main(11).xaml (12.1 KB)
Regards,
Yoichi
(Yoichi)
September 16, 2022, 7:33am
4
Hi,
Or it might be better to use .Values instead of Split method, as the following.
Main(11).xaml (12.1 KB)
Regards,
Gokul001
(Gokul Balaji)
September 16, 2022, 7:45am
5
Hi @Raina_Ocean_Sanjay
You can also try with Regex Expression
Check out the XAML file
Main (9).xaml (13.9 KB)
Output
Regards
Gokul
@Raina_Ocean_Sanjay ,
Alternately, You could also directly convert the JArray to a Datatable using the below :
OutputDT = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Datatable)(jobj("data").ToString)
You wouldn’t need to use For Each Activity. In the above case, you wouldn’t need to use Build Datatable Activity, we can directly assign it to an Empty Datatable.
You could then use Filter Datatable Activity to keep only the Required Columns.
As i only need to fetch the data for
date , area name , comfirmed and death
so this is not working for me , if i need to fetch all of the data then i can do this
Regards
Yes , this is the perfect output i was looking for
Regards
yes this can also work for me
Regards ,
1 Like
system
(system)
Closed
September 19, 2022, 8:50am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.