In an Gallery for the Item Property, I have the following definition:
ForAll(Filter(MR_POH,JobNo=Job_Gallery.Selected.JobNo &&
(Dropdown1.Selected.Value=Status || Dropdown1.Selected.Value="ALL")) As _item,
With(LookUp(
DropColumns(
AddColumns(
GroupBy('[dbo].[MR_POL]',"PackageNo","GroupedItems"),
"QTYSUM",Sum(GroupedItems,QTY)
),
"GroupedItems"),
PackageNo = _item.PackageNo),
Patch(_item,
{
QtySum: QTYSUM
})))
I'd like to include a sequential row number for each row using the Sequence function returned in above result set.
Sequence function in Power Apps - Power Apps | Microsoft Docs
Thank you
Solved! Go to Solution.
It's not pretty, but if you have an items property set to the expression X, you can add an index to it using an expression similar to the one below:
With(
{ coll:X },
ForAll(
RenameColumns(Sequence(CountRows(coll)),"Value","Index") As Idx,
Patch(Idx, Last(FirstN(coll, Idx.Index)))))
For your scenario, if you replace 'X' in the expression above with your original expression, you should get a new column called 'Index' in your gallery, something like the expression below:
With(
{ coll: ForAll(
Filter(
MR_POH,
JobNo = Job_Gallery.Selected.JobNo && (Dropdown1.Selected.Value = Status || Dropdown1.Selected.Value = "ALL")) As _item,
With(
LookUp(
DropColumns(
AddColumns(
GroupBy('[dbo].[MR_POL]', "PackageNo", "GroupedItems"),
"QTYSUM", Sum(GroupedItems, QTY)),
"GroupedItems"),
PackageNo = _item.PackageNo),
Patch(_item, { QtySum: QTYSUM })))
},
ForAll(
RenameColumns(Sequence(CountRows(coll)),"Value","Index") As Idx,
Patch(Idx, Last(FirstN(coll, Idx.Index)))))
Hope this helps!
It's not pretty, but if you have an items property set to the expression X, you can add an index to it using an expression similar to the one below:
With(
{ coll:X },
ForAll(
RenameColumns(Sequence(CountRows(coll)),"Value","Index") As Idx,
Patch(Idx, Last(FirstN(coll, Idx.Index)))))
For your scenario, if you replace 'X' in the expression above with your original expression, you should get a new column called 'Index' in your gallery, something like the expression below:
With(
{ coll: ForAll(
Filter(
MR_POH,
JobNo = Job_Gallery.Selected.JobNo && (Dropdown1.Selected.Value = Status || Dropdown1.Selected.Value = "ALL")) As _item,
With(
LookUp(
DropColumns(
AddColumns(
GroupBy('[dbo].[MR_POL]', "PackageNo", "GroupedItems"),
"QTYSUM", Sum(GroupedItems, QTY)),
"GroupedItems"),
PackageNo = _item.PackageNo),
Patch(_item, { QtySum: QTYSUM })))
},
ForAll(
RenameColumns(Sequence(CountRows(coll)),"Value","Index") As Idx,
Patch(Idx, Last(FirstN(coll, Idx.Index)))))
Hope this helps!
User | Count |
---|---|
257 | |
108 | |
90 | |
51 | |
44 |