I'm able to generate the collection with split column values, but struggling to generate row numbers correctly for the split values
ClearCollect(Collection1,ShowColumns(Filter('SPList',ID=1),"column1"));
Set(stored1, Concat(Collection1, column1));
Set(intRow,1);
ClearCollect(Collection2,ShowColumns(ForAll(Split(stored1,";"),{Column1: First(Split(Result,";").Result).Result,RowID:intRow}),"Column1","RowID"));Set(intRow, intRow+1);
Getting:
Column1 | RowID |
Value1 | 1 |
Value2 | 1 |
Value3 | 1 |
Value4 | 1 |
Value5 | 1 |
Looking for:
Column1 | RowID |
Value1 | 1 |
Value2 | 2 |
Value3 | 3 |
Value4 | 4 |
Value5 | 5 |
Solved! Go to Solution.
If you want to create a new collection with the column 'column1' from Collection1, and an index of the rows, you can use an expression like this one:
ClearCollect(
Collection2,
AddColumns(
RenameColumns(Sequence(CountRows(Collection1)), "Value", "RowID"),
"Column1", Last(FirstN(Collection1, RowID)).column1))
The idea is to first create the indices (using the Sequence function) then add the column from the original collection to it by accessing the object by index (using the Last(FirstN(collection, index)) construct).
Hope this helps!
I am not following your first few lines of the formula. You appear to be filtering to 1 specific record and returning just the "column1". This would mean that your stored1 variable would have the concat of 1 row...so not really needed since it is one row.
If you are just working with one row and a column that has delimited items in it, then consider this following formula:
Clear(colResults);
ForAll(
Split(LookUp(SPList, ID=1, column1), ";"),
Collect(colResults, {Column1: Result, RowID: CountRows(colResults)+1})
)
If you are doing this over several rows from your data source, then consider this formula:
Clear(colResults);
ForAll(
Split(
Concat(
Filter(SPList, 'lookupCriteria'),
column1 & ";"
),
";"
),
Collect(colResults, {Column1: Result, RowID: CountRows(colResults)+1})
)
I hope this is helpful for you.
If you want to create a new collection with the column 'column1' from Collection1, and an index of the rows, you can use an expression like this one:
ClearCollect(
Collection2,
AddColumns(
RenameColumns(Sequence(CountRows(Collection1)), "Value", "RowID"),
"Column1", Last(FirstN(Collection1, RowID)).column1))
The idea is to first create the indices (using the Sequence function) then add the column from the original collection to it by accessing the object by index (using the Last(FirstN(collection, index)) construct).
Hope this helps!
I am not following your first few lines of the formula. You appear to be filtering to 1 specific record and returning just the "column1". This would mean that your stored1 variable would have the concat of 1 row...so not really needed since it is one row.
If you are just working with one row and a column that has delimited items in it, then consider this following formula:
Clear(colResults);
ForAll(
Split(LookUp(SPList, ID=1, column1), ";"),
Collect(colResults, {Column1: Result, RowID: CountRows(colResults)+1})
)
If you are doing this over several rows from your data source, then consider this formula:
Clear(colResults);
ForAll(
Split(
Concat(
Filter(SPList, 'lookupCriteria'),
column1 & ";"
),
";"
),
Collect(colResults, {Column1: Result, RowID: CountRows(colResults)+1})
)
I hope this is helpful for you.
I'm trying to split the values from column1, with your example the collection still displays a delimited value. @RandyHayes answered my question with his first example. Thanks for taking the time to look at it though and showing me the sequence function, I'll probably use it at some point.
Actually the approach that @CarlosFigueira could work as well, it is just another trick to get sequential numbers into a table.
Glad it is working for you.
User | Count |
---|---|
263 | |
110 | |
98 | |
55 | |
40 |