Hello,
Does anyone know of a way to check for the existence of a specific collection name?
I originally tried to see if the CountRows function would work but Power Apps did not seem to like that when the collection does not exist.
Has anyone come across this issue before?
Thanks!
To check the name, Go-to FILE... COLLECTION...All Collections will show for you to choose what you are looking for
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Thanks for your reply.
I am aware of what you mentioned but perhaps I should give more context.
I recently had to split up a screen into two. I used to be able to save all my data to one collection but now I plan to create two collections and afterwards, merge the two collections (no common field in common).
Users might need to go back to these screens afterwards which is why I wanted to check for their existence on each of the two possible screens. Because I will merge the collections later I need to ensure that both collections are not empty.
If the user is on the first screen for the first time then the second collection has not been created yet. I wanted to create an IF scenario. If 2nd collection does not exist then do this...
Thank you!
Hi @Delminium :
I suggest you continue to use CountRows.Because the "collection does not exist" that you are worried about will not happen.
As long as the formula that defines the set exists, even if the command is not executed, the set will exist (with no records).
I've made a test for your reference:
As you can see. I didn't execute any commands at the beginning, I just wrote the formula. When I check the collections in File-Collections, it shows that these collections already exist (With no record). After I execute the command, there are some records in these collections. Even though the "ClearCollect(ddd,{c:"D"})" command can never be executed, the collection "ddd" still exists.
Best Regards,
Bof