cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How can i Automate a Consecutive order

Good day, I require your support:

I have an application with multiple accesses to sharepoint lists. Which is used by various administrative areas. Every day we make orders, which have a numerical order.

There is some way that when a partner goes to create a new order, the consecutive order is automatically selected.

Currently we do it in an excel shared by Teams and it is easy to see this.

However, the director requires reports of this information in BI and from Excel, there are problems with the standardization of the data. 

 

This first column is what i want to show or do automateThis first column is what i want to show or do automate

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @Mike_Gzz ,

Sorry I missed your post - if you tag me in the reply, it is much easier to see in my feed.

That is a whole new question to what you asked in your post. This is getting much more complicated - the direction you would need to take would be to first test for existing records on that day and then use the formula if they were present, or set to 1 if not. So set a Variable at some point

Set(
   vExist,
   !IsBlank(
      Lookup(
         YourListName,
         YourDateField=Today(),
         YourDateField
      )
   )
)

This will return true or false as to whether a record exists for the day.

Then it gets a bit more complex again in the Default as you now have to find the highest number for the day

If(
   YourFormName.Mode = FormMode.New,
   If(
      vExist
      First(
         Sort(
            Filter(
               YourListName,
               YourDateField = Today()
            ),
            YourNumberField,
            Descending
         )
      ).YourNumberField+1,
      1
   ),
   Parent.Default
 )

Note I have free-typed this, so please check all commas/brackets.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

14 REPLIES 14
Highlighted
Super User III
Super User III

Hi @Mike_Gzz ,

The next number would be

First(
   Sort(
      YourListName,
      YourNumberField,
      Descending
   )
).YourNumberField+1

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted

Thanks for the support. Sounds like it will work.

Could you support me step by step? Where should I integrate this formula?

A doubt, this formula will continue adding. But everyday changes, orders start at 1 again. It is also possible?

Highlighted

OK @Mike_Gzz ,

The easiest way would be to have this field on your form and have this as the Default value of the control (replace everything with Your in front with the actual names)

If(
   YourFormName.Mode = FormMode.New,
   First(
      Sort(
         YourListName,
         YourNumberField,
         Descending
      )
   ).YourNumberField+1,
   Parent.Default
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted

Hi @Mike_Gzz ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted

Hi @WarrenBelz ,

 

Idk if im doing this rigth. 

I put your code in the Default Value on PowerApps. But its detects error.

 

I have to change the , to ; 'cause mi region. But the error seems to be in the end, if i copy paste like you this happens: z.png

And if i delete the dot : 
z.png

 

Some Help?

 
Highlighted

Hi @Mike_Gzz ,

There is something else wrong here - in the below, the highest number I have in my test list is 4 and the code gets me 5.NextNumber.png

 

 

 

 

 

 

What does the error say when you hover over the red cross? Also for the moment delete Parent.Default and see if that is the issue.

Also please confirm you have this code in the Default of the Control, not the DataCard.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted

Great, with this code I could already do it without error, however, it is not specifically what I am looking for.

What this code does is add 1 to the number of my column of daily orders. However, it does not restart when starting another day. Example today 04/28, we have 40 orders. Tomorrow this should start again from 1.

 

Its possible?

Highlighted

Hi @Mike_Gzz ,

Sorry I missed your post - if you tag me in the reply, it is much easier to see in my feed.

That is a whole new question to what you asked in your post. This is getting much more complicated - the direction you would need to take would be to first test for existing records on that day and then use the formula if they were present, or set to 1 if not. So set a Variable at some point

Set(
   vExist,
   !IsBlank(
      Lookup(
         YourListName,
         YourDateField=Today(),
         YourDateField
      )
   )
)

This will return true or false as to whether a record exists for the day.

Then it gets a bit more complex again in the Default as you now have to find the highest number for the day

If(
   YourFormName.Mode = FormMode.New,
   If(
      vExist
      First(
         Sort(
            Filter(
               YourListName,
               YourDateField = Today()
            ),
            YourNumberField,
            Descending
         )
      ).YourNumberField+1,
      1
   ),
   Parent.Default
 )

Note I have free-typed this, so please check all commas/brackets.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted

@WarrenBelz Hi,
I put the set in OnVisibile of the screen and everything is fine.

16.png

 

when I put the rest of the formula it marks me error (an operator was expected):
If (
   Form1.Mode = FormMode.New;
   If (
      vExist
      First (
         Sort (
            Filter (
               Orders;
               Date = Today ()
            );
            Daily Order;
            Descending
         )
      ) .DailyOrder + 1;
      one
   );
   Parent.Default
 )

 

Any advice? or something am I doing wrong?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,438)