Hi all,
I am getting data from excel sheet (3 Columns), I just need to validate 1 column in that excel sheet could you tell me how can i get the 1st column seperatly by using readexcelsheet() function
Discussion posts and replies are publicly visible
You should be able to index the return it gives you. When recently using this we found turning the result set in to json and then from json helped us navigate around the data set far easier and apply validation.
here I need 1st coumn for one validation and 2nd column for another validation Separately
in readexcelsheet() we have numberOfColumns parameter you can use that
readexcelsheet( todocument( 123456 ), 0, 0, 1)
where 4 th parameter is numberOfColumns
if i use this i am getting 2 columns combinly
that means
If I use numberOfColumns i am getting {data1; data-A; data2; data-B}
I need output like
{data1;data2}
{data-A; data-B}
a!localVariables( local!data: readexcelsheet( todocument( 123456 ), 0, 0 ).result.values, a!forEach( items: { 1, 2 }, expression: a!localVariables( value: fv!item, a!forEach( items: local!data, expression: fv!item[local!value] ) ) ))
Hi Nikkheel,
Use readexcelsheet(cons!SD_DOC_SampleExcel /* document id */,0,0,2/*which column you need to fetch*/).result.values[2/*which column you need to fetch*/]
readexcelsheet(cons!SD_DOC_SampleExcel,0,0,2).result.values[2] => will give you list of string of that perticular column.
this is returning row
This is a good use case for a!forEach - since without looping over the returned data, it's difficult to index into a particular column (since as you noted in a previous reply, the first attempt to index automatically narrows the result down to that row).
a!localVariables( local!excelData: readexcelsheet( ... ).result, local!column1data: a!forEach( local!excelData, index(fv!item.values, 1, null()) /* replace "1" with any other column number you want to grab */ ), local!column1data )
Yes, it will return perticular column of data. So that you will be having column 2 data. now you can validate the column 2 as per your buisness rules.
I don't believe this is correct - when I tried it, I verified that it returns data for a row and not for a column, just like @nikkheel said. The method I posted below should work for pulling from a specific column.