Hi! I would like to separate the transections in a gallery and use the coding below
for go to the first-page button.
UpdateContext(
{
iter: RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
);
FirstN(
col_insuranceData,
iter
)
for previous page button
If(
iter < 2 * RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
),
UpdateContext(
{
iter: RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
);
FirstN(
col_insuranceData,
iter
),
UpdateContext(
{
iter: iter - RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
)
)
for next-page button
If(
iter < CountRows(col_insuranceData),
UpdateContext(
{
iter: If(
iter < CountRows(col_insuranceData),
iter + RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
)
}
)
)
for last-page button
UpdateContext({iter: CountRows(col_insuranceData)}); LastN(col_insuranceData, iter)
and in the Gallery Item
LastN(FirstN(col_insuranceData, iter), RoundDown(Gallery_LicenseSearch.Height/Gallery_LicenseSearch.TemplateHeight,0))
Everything can use but when I get the code for search in Gallery Item like the picture below it has an error.
Thank you so much for the help in advance!
Solved! Go to Solution.
Hi @infinitepp :
I have provided detailed steps and codes in the previous solution. If you need to combine these two functions, you need to combine these two formulas in a nested way instead of simply using || or, connect them.(In addition, the formulas in other buttons also need to be modified)
The Code should be:
LastN(FirstN(
If(
dd_licenceType_2.Selected.Result = "ทั้งหมด",
col_in,
Filter(
col_in,
Or(
txtSearchLicense_3.Text in SaleCode,
txtSearchLicense_3.Text in sale_FName,
txtSearchLicense_3.Text in sale_LName
) && license_name = dd_licenceType_2.Selected.Result
)
)
, iter)
Best Regards,
Bof
Hi @infinitepp :
Firstly,let me explain why you encountered this problem.
The point is syntax error.
The value of "LastN(……)" is a Table
The value of "If(xx,Table1,Filter(Table……))" is an other table
So your Gallery's items property looks like this:
Table1,Table2
It's wrong.The point is that one gallery cannot use two tables as its data source at the same time.
Secondly,If you need to combine the two functions,my suggestion is to replace all
col_insuranceData
with
If(XX,col_insuranceData,Filter(col_insuranceData,XXX))
For example:
for go to the first-page button.
UpdateContext(
{
iter: RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
);
FirstN(
If(XX,col_insuranceData,Filter(col_insuranceData,XXX)),
iter
)
for previous page button
If(
iter < 2 * RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
),
UpdateContext(
{
iter: RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
);
FirstN(
If(XX,col_insuranceData,Filter(col_insuranceData,XXX)),
iter
),
UpdateContext(
{
iter: iter - RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
}
)
)
for next-page button
If(
iter < CountRows(If(XX,col_insuranceData,Filter(col_insuranceData,XXX))),
UpdateContext(
{
iter: If(
iter < CountRows(If(XX,col_insuranceData,Filter(col_insuranceData,XXX))),
iter + RoundDown(
Gallery_LicenseSearch.Height / Gallery_LicenseSearch.TemplateHeight,
0
)
)
}
)
)
for last-page button
UpdateContext({iter: CountRows(If(XX,col_insuranceData,Filter(col_insuranceData,XXX)))}); LastN(If(XX,col_insuranceData,Filter(col_insuranceData,XXX)), iter)
and in the Gallery Item
LastN(FirstN(If(XX,col_insuranceData,Filter(col_insuranceData,XXX)), iter), RoundDown(Gallery_LicenseSearch.Height/Gallery_LicenseSearch.TemplateHeight,0))
Best Regards,
Bof
Thank you for your explanation I have got the knowledge from that a lot. But I'm really sure the collection that col_insuranceData is just only one Collection table is connected with the Gallery.
The problem is I have no idea how to get searching code after LastN(FirstN(col_insuranceData, iter), RoundDown(Gallery_LicenseSearch.Height/Gallery_LicenseSearch.TemplateHeight,0))
and this is the code for searching.
If(
dd_licenceType_2.Selected.Result = "ทั้งหมด",
col_in,
Filter(
col_in,
Or(
txtSearchLicense_3.Text in SaleCode,
txtSearchLicense_3.Text in sale_FName,
txtSearchLicense_3.Text in sale_LName
) && license_name = dd_licenceType_2.Selected.Result
)
)
I tried to use || & && , but syntax error.😔
Thank you.
Hi @infinitepp :
I have provided detailed steps and codes in the previous solution. If you need to combine these two functions, you need to combine these two formulas in a nested way instead of simply using || or, connect them.(In addition, the formulas in other buttons also need to be modified)
The Code should be:
LastN(FirstN(
If(
dd_licenceType_2.Selected.Result = "ทั้งหมด",
col_in,
Filter(
col_in,
Or(
txtSearchLicense_3.Text in SaleCode,
txtSearchLicense_3.Text in sale_FName,
txtSearchLicense_3.Text in sale_LName
) && license_name = dd_licenceType_2.Selected.Result
)
)
, iter)
Best Regards,
Bof
Thanks! Now It works for me.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
207 | |
72 | |
51 | |
49 | |
20 |
User | Count |
---|---|
264 | |
123 | |
85 | |
79 | |
70 |