Hi,
New to powerapps and not entirely sure what is happening with my app. I am patching data from a collection and for some reason when i click my "SAVE WIP" button it is creating a duplicate of my first row in the gallery from the colgriddata. Below is a copy of the code for the onselect function for my "SAVE WIP" button. Every time i click the button it keeps returning duplicates even though no data was edited.
If(
varGridEdit,
If(
!IsBlank(
LookUp(
colGridData,
IsBlank(Title)
)
),
Notify(
"Please Enter Block Number",
NotificationType.Error,
2000
),
Patch(
'QSV WIP Monitor',
UpdateIf(
colGridData,
Created = Blank(),
{ID : Blank()}
)
);
Remove('QSV WIP Monitor',colDelete);
Notify(
"WIP Updated",
NotificationType.Success,
2000
);
Clear(colDelete);
Select(btnLoadData);
Set(
varGridEdit,
!varGridEdit
)
),
Set(
varGridEdit,
!varGridEdit
)
);
Thanks,
Kurt
Solved! Go to Solution.
At the end of the Save command. Previously we had Clear(colGridData). It stores the duplicate. That's good.
Now will replace that line with this
ClearCollect(colGridData, DataSource); //Clears the collection and stores data from Data source
So that it clears the collection and gets the updated data from Datasource together. So that your gallery items property will use the collection.
Hi @KurtH1994
Not seeing the code to Clear the collection once data is Saved. Please try this code
If(varGridEdit,
If(
!IsBlank(LookUp(colGridData,IsBlank(Title))),
Notify("Please Enter Block Number",NotificationType.Error,2000),
Patch('QSV WIP Monitor', UpdateIf(colGridData, IsBlank(Created),{ID : Blank()})
);
Remove('QSV WIP Monitor',colDelete);
Notify("WIP Updated",NotificationType.Success,2000);
Clear(colDelete);
Select(btnLoadData);
);
Set(varGridEdit,!varGridEdit);
Clear(colGridData);
Thanks,
Stalin - Learn To Illuminate
That works for not populating duplicates, however i want to retain the values when editing the gallery table. As the gallery items uses "colGridData" i can no longer see the previous entries to edit. See below:
Thank you for assisting me!
Kurt
Hi @KurtH1994
I have updated the above code. Please try and let me know.
Thanks,
Stalin - Learn To Illuminate
Hi @KurtH1994
We need to load the data from Datasource to collection again to start to make edits.
Set(varGridEdit,!varGridEdit);
ClearCollect(colGridData, DataSource); //Clears the collection and stores data from Data source
Apologies for my lack of understanding, do i need to put this at the start of the complete code you posted previously?
Thanks
At the end of the Save command. Previously we had Clear(colGridData). It stores the duplicate. That's good.
Now will replace that line with this
ClearCollect(colGridData, DataSource); //Clears the collection and stores data from Data source
So that it clears the collection and gets the updated data from Datasource together. So that your gallery items property will use the collection.
Thanks a lot! That worked with a couple of tweeks with bracketing and semi colons!
Below complete code:
If(varGridEdit,
If(
!IsBlank(LookUp(colGridData,IsBlank(Title))),
Notify("Please Enter Block Number",NotificationType.Error,2000),
Patch('QSV WIP Monitor', UpdateIf(colGridData, IsBlank(Created),{ID : Blank()})
);
Remove('QSV WIP Monitor',colDelete);
Notify("WIP Updated",NotificationType.Success,2000);
Clear(colDelete);
Select(btnLoadData);
Set(varGridEdit,!varGridEdit)),
Set(
varGridEdit,
!varGridEdit
)
);
ClearCollect(colGridData, 'QSV WIP Monitor'); //Clears the collection and stores data from Data source
Really appreciate your help!!
Kurt
Hello @StalinPonnusamy
Apologies, but after clicking the save button on my app it appears to be still duplicating the first row of the gallery but not any other rows. Are there any other parts of my app you wish to see in order to understand my problem further?
Thanks again for your continued help.
Kurt
Could you make it work eventually?
Val
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |