I'm trying to find a solution to my problem.
My problem is that i need to generate a "User ID" in for a dataverse row which is just a number. But it needs to be unique and if we remove a user who was given a "User ID" number earlier, then it should be able to use the number again. But the main thing is that it always selects the lowest available number in the column.
Hope you can help, thanks 🙂
Solved! Go to Solution.
Hi @Waegemma ,
I used your code into a button, then i made a label which has the First(colEmptyID).UserID in the text field.
And it all looked good with the right number in the label, but when i added the number to the dataverse column (to simulate me reusing the number) and pressed the button to update the changes. It just goes blank and it feels like it has corrupted the column because i cannot display anything from it in the app, but i there is no problem when i look at the data in the dataverse column.
If you have any idea it would be much appreciated 🙂
Hi @RealMABN ,
I suppose your Dataverse column is a number field? Did you update it with the First(colEmptyID).UserID or with the Label's Text property? That might be the problem.
Other thought: is the UserID column in your Dataverse table a column you added, or did you rename an existing column?
You also say you can see the data in the Dataverse, does it show the row with the added UserID? If so: perhaps your code to retrieve the Data to your app is faulty?
Hi @Waegemma ,
To answer your questions 🙂
1: I suppose your Dataverse column is a number field?
A: Yes, the column is a whole number data type 🙂
2: Did you update it with the First(colEmptyID).UserID or with the Label's Text property?
A: I have only tried to receive the data with "First(colEmptyID).UserID" and "Text(First(colEmptyID).UserID)" in the label. But I'm using the button with your code to create and use the variables 🙂
3: is the UserID column in your Dataverse table a column you added, or did you rename an existing column?
A: I have tried with 3 different kinds of new made columns(with difrrent names instead of reusing UserID) 🙂
4:You also say you can see the data in the Dataverse, does it show the row with the added UserID?
A: No new rows or records has been added with me manually adding them by hand 🙂
5: perhaps your code to retrieve the Data to your app is faulty?
A: Well, to my understanding isn't it your code which receives the data? 🙂
Hope this gives a better understanding 🙂
Thanks again for your suggestions!
Hi @RealMABN ,
Thanks for the answers.
My code doesn't update you list, it just generates a UserID, without changing your data. If you want it to create a new record with the UserID, you would have to use a form, where the generated UserID is then inserted in the right field (UserID).
I found another way to this and it worked without any problems 🙂 Sorry for wasting your time
This is the code that worked for me:
Sequence(CountRows(MyTable.ColumnName) + 1),
Not(Value in MyTable.ColumnName)
Thanks for your help!
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.
We are excited to announce a new way to share your ideas for Power Apps!