If I am right, Mit Ai2 is forcefully adding double quotes and other symbols in the data (eg. numerical data)

If I am right, Mit Ai2 is forcefully adding double quotes and other symbols in the data (eg. numerical data) when we save it as csv file or text file. Because, of this behavior it is difficult to perform certain tasks or to save the output as the expected standard-csv file. Please, don't add quotes forcefully.

If we use replace-segment block to remove the quotes, still it is forcefully adding quotes. If I am right then correct this by providing one more option to avoid forcefully being added quotes/unnecessary symbols from the data. Thankyou.

This is because the widely accepted "correct format for a csv" is to double quote strings. In some cases, integers/numbers may also be double quoted.

It may also depend on where your data comes from, for example, if you export google sheet data as a csv (using the web component), it generally arrives in AI2, as responseContent, without double quotes.

This should not cause you any problems, you do not indicate what problems you are having with this correct csv format? You may need to convert to an AI2 list, and work on the list, before converting back to csv ?

Please provide examples...

1 Like

Okay, If mit ai2 provide options in designer section to choose which type of csv file we want as output, then it will help a lot.

I tried using list, I tried using replace-segment block as well, but at the end mit ai2 will include quotes in the csv file.

So options to choose the csv file type in the designer section will be help a lot.

As requested...

You also mention "other symbols" - please also provide examples of this...

I have to manually remove the quotes and symbols to use the csv file in ecommerce websites to update product details. Because, those site is demanding standard csv file and not quoted csv file.

And another thing is, if i am wishing to use the data from csv file (csv file contains data like 3,2,1,8,5,9,2, etc.) in such a way that each data can be chosen one after other using for loop (and list of lists maybe), when additional symbols are added, these additional symbols are creating confusion to me since i am a beginner. Do I have to remove the symbols to separate each data for putting it in for loop?

What symbols ?

You are not really providing any examples or situations that generate the issues you are referring to...

On reflection csv format may not be the best method to exchange data, you might consider json or json arrays as an alternative if working in an html environment. Seems this is an issue of your own making ?

2 Likes

My goal is to check the possibility. If the text file contains data 3,5,8,3,2,6, etc. and if csv file contains the following data

onesignalid1,keyword1
onesignalid2,keyword2
onesignalid3,keyword3
onesignalid4,keyword4
onesignalid5,keyword5
onesignalid6,keyword6
etc.

The data from text file should be considered as row numbers/index and when FOR loop chooses the first data/number from text file, and since the first number is 3, the FOR loop has to parse the onsignalid from row 3 of csv file. The parsed onsignal id will be put in the global variable to send notification to that onesignalid apps and the for loop will do this for all the data of text file.

My goal is to check the possibility first eventhough it may not be the good idea.

Also not too sure what the issue is:

image

Content in demo.csv
image

1 Like

I agree you got this output. But, can you split this data using , .If it is possible then please share that result as well. Because when i tried that, the quotes appeared back again.

To put the data in a for loop, we have to separate each data individually, am i right?

If you use the split block you will create an AI2 list.

You would first need to split at \n in order to get a list of each row, then you could split each row to a list.

There should be no issues if requiring to iterate over an AI2 list of lists.

1 Like

Thankyou. Okay, I shall do this for csv file.

How can I split text file data?

And, csv file contains two columns, i want to parse data from first column of the specific row.

Use the split block and a delimiter of your choice (e.g. comma or \n)

1 Like

So, since the data will turn into lists while i split it, i don't need to bother about the quotes or square brackets around the data, am i right? It will work on FOR loop and on list of lists, am I right?

1 Like

Your example request popped up after I had moved on. perhaps something like this, I am not too sure what you wanted from your second list in the csv, so I picked the keyword.

The output list should contain the keywords for each of the numbers from the numbersList found in the onesignalid values

1 Like

See Price calculator - #16 by ABG
for a value procedure to de-quote single number items.

1 Like