Hi Guys,
I have an app which includes a gallery where a user can select a number of products. On each gallery item there are 2 combo boxes, let's call them cmb_1 and cmb_2. cmb_1 acts as a filter for cmb_2. A product hierarchy if you like.
After I have saved the first product it patches to a collection, when I then go back and change cmb_1 I would like to clear the contents of cmb_2 but I can't get it working.
The default selected items property of cmb_2 is:
{Value:ThisItem.ProductCategory}
So it will take the value of whatever is in the collection and I can't get it to clear. This means a user could potentially save an invalid product combination.
I tried to reset it by adding the following code to the on change of cmb_1:
UpdateContext({varReset:true});
UpdateContext({varReset:false})
And then the following code to the reset of cmb_2:
varReset
This does work if I haven't patched the record to the collection but after I patch it cmb_2 value won't clear.
I understand why it's happening, just not sure how to fix it.
Hi @JimJim
Please let us know if anything needs on your post. We can help with this.
Please mark the post as Solved If I have answered your question.
Please give it a Thumbs Up if you find the suggestion helpful
Thanks,
Stalin - Learn To Illuminate
Hi @JimJim
You can have a dummy ID if you want like GUID and check the length when saving the record. The length is 32 means a new record.
Another option is to have ID as GUID and another field for Flag (Boolean) for new records. So that when you are saving the record check that flag. If it's true it means new.
In this case, you can use SP ID (Numeric) and the GUID for any data manipulation.
Thanks,
Stalin - Learn To Illuminate
Hi @StalinPonnusamy ,
Thank you for replying, but this doesn't work unfortunately.
The ID will never exist in the collection until it writes to the SP list, it does this on the OnSuccess of the form (I should have made this clearer)
I think my best option here is to replace the combo boxes with drop downs as they behave differently
Hi @JimJim
Will try another approach.
Set the OnChange property of Combo 1 to
If(Not(ThisItem.ID in ColItemSelected),Collect(ColItemSelected, {ID:ThisItem.ID}))
Set the DefaultSelected property of Combo 2 to
If(ThisItem.ID in ColItemSelected.ID, {Value : Blank() },{Value: ThisItem.ProductCategory})
Set OnSelect property of Save or Patch to
Clear(ColItemSelected)
Thanks,
Stalin - Learn To Illuminate
WarrenBelz
146,522
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,890
Most Valuable Professional