Hello Everyone,
I am working on an office supply system and in that more than 200 items list.
The user is allowed to select items from the gallery and stored them in the collection before final submission.
Here I would like to send the error to the user when he/she will select an item from the list again and send it for collection list submittion.
Please share with me any example which can help me understand the process.
Solved! Go to Solution.
Hi @tusharmehta ,
I am guessing a bit here, but do you want to check that the value in the field Elocation does not already exist in the gallery?
If(
!(ThisItem.Elocation in CollectionName.Elocation) ||
!IsBlank(order_name.Text),
Collect(
MyCart,
{
ID: ThisItem.ID,
OrdererName: order_name.Text,
OrderDate: Now(),
Quantity: Value(1),
Product: ThisItem.offsupp_product,
Measurement: ThisItem.Measurement,
DefaultValue: ThisItem.default_value,
Email: User().Email,
Location:order_location.Text,
ProductImgPath:ThisItem.prd_img_url,
ProductImgUrl:ThisItem.img_url,
Image: ThisItem.prd_img_url & ThisItem.img_url
}
),
Notify(
"Check Location, Name, can't be blank close the Application and re-open again"
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks to @WarrenBelz,
The problem is in this line !(ThisItem.Elocation in CollectionName.Elocation) The collection name is not recognizing..
Hi @tusharmehta ,
I assume that User is selecting item from Gallery but doesn't have visual knowledge whether the item is in collection or not.
If this is the case then you can add an indicator or templatefill for Gallery by checking if the Unique item ID is present in collection or not, rather than inserting into collection with duplicate records.
You can also check if similar records exist. 1 of the way is given by WarrenBelz reply on this Post.
Hope this helps.
Hi @tusharmehta,
Have you solved your problem?
Do you want to check if the selected record from the Gallery duplicated?
Could you please share a bit more about the scenario, how you select multi records from the Gallery, using Checkbox?
I assume that you insert Checkbox into the Gallery to select multi records. To check if the selected record duplicated, you just need to set the OnCheck property of the Checkbox as below:
If(ThisItem in CollectionName,
Notify("Selected Record Existed!",Error),
<Your Patch formula>
)
Thanks for the reply.
I am forwarding the code which works fine without duplicate checking.
This application allows the employee to order office items from the gallary.
If(!IsBlank(Elocation) || !IsBlank(order_name.Text),
Collect(
MyCart,
{
ID: ThisItem.ID,
OrdererName: order_name.Text,
OrderDate: Now(),
Quantity: Value(1),
Product: ThisItem.offsupp_product,
Measurement: ThisItem.Measurement,
DefaultValue: ThisItem.default_value,
Email: User().Email,
Location:order_location.Text,
ProductImgPath:ThisItem.prd_img_url,
ProductImgUrl:ThisItem.img_url,
Image: ThisItem.prd_img_url & ThisItem.img_url
}),
Notify("Check Location, Name, can't be blank close the Application and re-open again")
)
if I will have to follow your code I believe I will have to add a NOT IN with current if Condition correct, if yes update the code and send me the example. Because I am not able to use NOT IN.
Hi @tusharmehta ,
I am guessing a bit here, but do you want to check that the value in the field Elocation does not already exist in the gallery?
If(
!(ThisItem.Elocation in CollectionName.Elocation) ||
!IsBlank(order_name.Text),
Collect(
MyCart,
{
ID: ThisItem.ID,
OrdererName: order_name.Text,
OrderDate: Now(),
Quantity: Value(1),
Product: ThisItem.offsupp_product,
Measurement: ThisItem.Measurement,
DefaultValue: ThisItem.default_value,
Email: User().Email,
Location:order_location.Text,
ProductImgPath:ThisItem.prd_img_url,
ProductImgUrl:ThisItem.img_url,
Image: ThisItem.prd_img_url & ThisItem.img_url
}
),
Notify(
"Check Location, Name, can't be blank close the Application and re-open again"
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thanks to @WarrenBelz,
The problem is in this line !(ThisItem.Elocation in CollectionName.Elocation) The collection name is not recognizing..
Hi @tusharmehta ,
Go to View > Collections > YourCollectionName and see what is in there
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 |
---|---|
197 | |
72 | |
50 | |
41 | |
30 |
User | Count |
---|---|
255 | |
113 | |
95 | |
91 | |
75 |