Create a random number when a new Form is submitted - excel

I have created a Microsoft form for Purchase Order Requests, when someone submits the form I would like the table on the excel worksheet to create a purchase order number, I am using a combination of sequential and random numbers to create this number.
My problem is that every time a new form is submitted and the worksheet is updated all of the random numbers are recalculated changing the purchase order numbers of other submissions.
Is there a way I can have the formula only calculate when there is a new row added to the table(a new form submission) or any ideas how I can create this number within the Microsoft Form?
I have tried using the Excel online script to create the random number and it's triggered by Power automate flow but I keep getting failed flow runs, and I can't have any failed flow runs at anytime.
Thanks for your help

Related

Power Automate - Update last row in an Excel table

I currently use an Excel spreadsheet to store all users 4 digit printer code. This 4 digit code is incremental so when a new user joins our team, their code will be 1 digit higher than the previous user who joined, e.g. previous user code 1122, new user code 1123.
printer codes sheet
What I'm trying to do is:
Submit a form via MS forms with the basic details of the new user. The flow then adds the information from the form and adds it to the printer code excel sheet.
The flow will grab the printer code of the previous user above and raise the value by 1 and assign it to the new user added.
For the most part this process is working as intended. Where is it failing is the flow isn't grabbing the code from the previous user, but the code 250 rows earlier.
Please see my flow below:
Getting form details and listing rows in table
I then use 2 compose actions to grab the last row in the table and then update the value by 1:
grab last row
add + 1
The information from the form is then added to the spreadsheet table, using output 2 as the content for the Code column.
Add row
From what I can gather the problem is my first compose formula, as the incremental compose is adding +1, but not to the row above.
compose input/output
compose 2 input/output
The code the flow grabbed was 1388 as it will add the code 1389. But the last user added is 1641 so the new user should have a code of 1642.
If anyone knows what I am doing wrong and could share it would be greatly appreciated.
Thank you.
You can try this to get the row with the highest value in column “Code”:

Total a SharePoint Column to include in an email sent by Power Automate

I've built a SharePoint calendar that I'm using to track employee vacation time. The employee logs into a PowerApp, enters their information (including the amount of hours they are requesting off) and clicks a submit button. When the submit button is clicked a flow is triggered which generates a "Send an Email with options" to obtain the manager's approval.
What I'm trying to do is total the number of hours that an employee has already taken off for the current calendar year. I need an action that will reference the same list and find all items where the:
Start Date is in the current calendar year
Employee Name is the same as the employee requesting the time off
Status = Approved
And return the sum of the Total Hours Used column for the approved entries for that particular employee.
The idea is that the email that is sent to the manager should tell the manager how much time the employee has been approved to take off so far this year.
I started to construct a Get SharePoint Items action, however, I'm not sure if it will work. Here is what I have:
Anyone have any thoughts?
You have to iterate through all the items & sum it up using Apply to each, Compose and Increment variable pieces together. Read more
For detailed learning - Iterate and get all items from a SharePoint Large List or Library using Microsoft Flow (no-code solution)

Business Objects Web Intelligence automate report once for each parameter

Using Business Objects Web Intelligence or Rich Client, is it possible to schedule a report to automatically run and export to Excel once for each parameter?
Background: I have a single report that needs to be saved to different Excel files once a month but I have a parameter on a "client" dimension which can contain 30+ values. Each value needs to generate its own Excel file. I would prefer to not run the report 30+ times each month.
Is there a way to schedule or change the WID query so that a separate file is generated for each parameter value? Or maybe an alternative idea for this manual process?
This can be done using a Publication with Dynamic Recipients.
You would need to create a second report that would produce a list of all values in your Client dimension. This report would then serve as the source of the Dynamic Recipients in the Publication. In the base report, you would remove the prompt on Client but make sure that Client is included in the report results. Then in the Publication, you would set Personalization such that a filter is automatically applied to the Client dimension based on the values from the second report.

Re: Excel - How to create dynamic data validation list based on data table

I have a similar problem to one answered this past November. (Same general title.) The particulars of my problem are as follows:
I want to send users an excel template with validation rules. In the first column (Receipt/Disbursement), users select whether a record is a Receipt or Disbursement. For that, a discrete list (Receipt, Disbursement) is defined to validate against. This works fine.
On a subsequent column (Schedule), validation is to be based on a defined Schedule Table that references the Receipt/Disbursement column: If the user selected Receipt, a list of possible schedules from the Schedule Table is presented, if the user selected Disbursement, a different list of schedules from the Schedule Table is presented.
How do I base my validation (selection list) on the Schedule column on the result of the previously indicated Receipt/Disbursement column?
Thx!

Filling rows of a repeating table on opening the form

In my Infopath form I use a repeating table. On opening this form on sharepoint I would like to have some rows of the repeating table filled out using information from an other list. I use content types.
What i am working on is a Timesheet system where the user can register how many hours a week he worked on different projects.
I would like that by creation of a timesheet some predefined projects will be already inserted, meaning that the repeating table will have for example 5 rows already with 5 favourite or most used projects selected based on a separate PetProject list.
When I looked at the workflow in the list where the timesheet is being created I couldn’t find the column projectname in the dropdown so I cant give it a value. When I went to look in the Form settings of TimeSheets I saw that projectname cant be selected/edited, its in plain black whereas the other columns are blue and clickable. I thought its probably because the value of projectname is merged from the different rows in the repeating table.
Is there any way I can work around this problem and assign a value to projectname by creation of the timesheet?
Thank you so much!
I think that you will need to write some code to query the data that you are after and add the data to new rows in the repeating table.
There is a loading event that you can hook into to then query a secondary data source and then
add the row to the repeating table.
Will this run with in infopath as a thick client or will it run as a browser based form using infopath form service?

Resources