Hi All,
I need to implement auto sequence number with 4 digits of button onselect on powerapps screen which i need to patch in dataverse table. This sequence number should be maintained for all users. Can someone help suggest me on this criteria.
Thanks in advance
Solved! Go to Solution.
Hi, @yaseenshaikh301 ,
You can set a variable with value 0 Like : Set(varnum,0 )
on OnVisible Property of screen where you are using this functionality,
Then, you can set same variable on the icon where you want to increase number Like : Set(varnum, varnum + 1)
and on DisplayMode property of the same icon you can set a function like :
If( varnum <= 1,DisplayMode.Disabled,DisplayMode.Edit)
And for another icon where you want to decrees the number you can set variable on Onselect Property Like : Set(varnum, varnum - 1)
and on DisplayMode Property of same icon add formula like :
If(varnum >= 100,DisplayMode.Disabled,DisplayMode.Edit)
I hope that will work for you.
Thank you.
I am using sharepoint and powerapp. I created a shopping cart app on powerapp and after i click to send order, I want to generate a unique id which can be used as a reference to find out tracking status of the parcel
Hi @aaaa3
If you are using Sharepoint, then there is already an ID column that is Auto-increment and unique.
You can use that ID column to track an Order
Or else you can create a number column, If you are using form then add that column in form, and in the default property of that TextInput box you can set the formula as:- Value(Last(DataSourceName).ColumnName + 1)
Or if you are patching records on submit button then also you can use the same formula
This will create an auto-increment number every time you hit submit
I hope this will work for you
Thank you.
Hello, Can you kindly explain the formula Value(Last(DataSourceName).ColumnName + 1) and where should insert the code? I want to Click send order(which is submit button) then generate package id (package id need to be unqiue)
Hello @aaaa3
Value(Last(DataSourceName).ColumnName + 1) This formula will just increment the previous number which is present in the last row of the column which I told you to create in the previous comment.
Value(): This function will convert into value or numeric format
Last(): It will return the last row from the data source
ColumnName: It is the name of the column which you want to increment by + 1,
So you can add this formula where ever you want to generate the new number and save it to the database
If you want to generate a unique number then you can use Now() which will return Today's Date with the current time,
So you can use like : Concatenate(Value(Last(DataSourceName).ColumnName + 1),Now())
This always generates a unique number that you can use anywhere.
Hope this will help you
Thank you!
Thank you for your reply. May I know what should I do if i want to auto generate a new unique id (package Id) every time the user clicks on 'send order' button? What code should I put? Because I am not using column name value to increment. However, I want to generate auto increment id which means once a user submit, let say id of 6 is generated then the next user submit, the id generated is increased by 1 so is 7. Thankss
Hi, do yall know how to generate a unique id like a,b,c once button is clicked.
The delivery id generated will be used in another sharepoint list.
The id column used is Delivery_ID.
How to amend the codes below? Thanks.
SendEmailv2.Run(JSON(colOrderItems));
// insert new row for each product into SharePoint list
ForAll(
colOrderItems,
Patch(
OrderList,
Defaults(OrderList), {
Memory: Memory,
Storage: Storage,
Title: Title,
Quantity: Value(Quantity),
Price: Value(Price),
'TotalPrice (TotalPrice0)': TotalPrice,
Image: Image,
Dept: Dept,
Division: Division,
DeliverLocation: DeliverLocation,
'28ByteCode': '28 Byte Code',
Product: ProductFinal,
Processor: Processor,
DesktopAddon: DesktopAddon,
Remarks: Remarks
}
)
);
Notify("Order was successfully submitted", NotificationType.Success);
Hi @aaaa3 ,
If you are not using any column to store that auto-generated number,
So you can use the formula in this way : Concatenate(Value(Last(DataSourceName).ID + 1),Now()),
You can also add a Suffix before the unique id number
Like : Concatenate("Order_",Value(Last(DataSourceName).ID + 1),Now()),
I hope this will work for you.
Thank You!!
Hi, I am using column PackageID to store that id. Is this amended code okay to generatea unique id everytime i click on button?
SendEmailv2.Run(JSON(colOrderItems));
// insert new row for each product into SharePoint list
ForAll(
colOrderItems,
Patch(
OrderList,
Defaults(OrderList), {
Memory: Memory,
Storage: Storage,
Title: Title,
Quantity: Value(Quantity),
Price: Value(Price),
'TotalPrice (TotalPrice0)': TotalPrice,
Image: Image,
Dept: Dept,
Division: Division,
DeliverLocation: DeliverLocation,
'28ByteCode': '28 Byte Code',
Product: ProductFinal,
Processor: Processor,
DesktopAddon: DesktopAddon,
Remarks: Remarks
PackageID:
First(SortByColumns(‘OrderList’, “createdon”, Descending)).’ID’ + 1 & “ABX” })
}
)
);
Notify("Order was successfully submitted", NotificationType.Success);
Hi @aaaa3
I think this will not work what you have given.
due to this thing
Just update the formula which I have given to you it will create a unique id every time when you hit submit.
Concatenate("ABX_",Value(Last(DataSourceName).ID + 1),Text(Now(),"ddmmyyyy")
Because the ID column is unique and will not be duplicated and also along with that I'm including the Date and Time which will give you a Unique number every time you submit.
Try this one, Hope this will work
Thank you.
User | Count |
---|---|
254 | |
112 | |
92 | |
48 | |
38 |