Forum Discussion
Expand Sharepoint List with more rows that are predefined.
- Jan 17, 2023
Fraita I haven't looked at the video but the title of it doesn't lead me to think it has any relevance for your scenario. For this I've just used the dates & times that were in your image and then created the equivalent items for the following week. So the initial SharePoint list looks like this - make sure your weeknumber column is a number column.
Then your flow will be as follows:
1. The trigger is a recurrence schedule set to run once a week
2. Then initialize 2 float variables, one for the current week number and one for the next week number:
3. Next, we want to get what the current week number is, so add a SharePoint "get items" action and in the Order By field type WeekNumber desc and set the Top Count field to 1:
4. Next, even thoiugh we are only bringing back 1 item you neverthelss need add an apply to each and select value from the dynamic content box (if you don't do it Powwer Automate will add it for you). Add a compose action and for the Inputs field select WeekNumber from the dynamic content box.
Next add 2 Set variable actions. For the first one set the value to be the outputs of the previous compose which you select from the dynamic content box. For the second one click in the Value field and select the Expression tab in the dynamic content box enter add(variables('varCurrentWeekNumber'),1) which adds 1 to the current week variable and stores it in the next week number variable.
5. Next, we want to bring back from the list all those items where the week number equals the current week number variable. To do this add another get items action, open the advanced options and in the Filter Query field type WeekNumber eq '' and inside the single quotes select the current week number variable from the dynamic content box.
6. Add another apply to each control and make sure to selecdt the correct value from the get items 2 section of the dynamic content box.
Next, add a compose for the current items date column, and select Date
Next, add another compose and for this we'll add 7 days to the date in the compose above using the expression addDays(outputs('ComposeCurrentDate'),7)
7. Finally, add a SharePoint create item action. For the weeknumber field select the next week number variable. The weekday, PVV and UNI3 columns aren't changing so just select the appropriate one for each field from the dynamic content box. And for the date field select the outputs of the compose new date you added in the previous step.
When you run the flow it it will create a new equivalent item for next week for each of the items in the current week. This runs every 7 days but you could do it further ahead just by changing the comose new date expression.
Hope that helps.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
RobElliott
I do actually have some experience in Power Automate. Not sure how to start though.
I found this link: https://www.youtube.com/watch?v=Vt_N2ZRN2F4
Would you do it any other way? So it becomes more automated, because above video is more like 1-time solution.
Fraita I haven't looked at the video but the title of it doesn't lead me to think it has any relevance for your scenario. For this I've just used the dates & times that were in your image and then created the equivalent items for the following week. So the initial SharePoint list looks like this - make sure your weeknumber column is a number column.
Then your flow will be as follows:
1. The trigger is a recurrence schedule set to run once a week
2. Then initialize 2 float variables, one for the current week number and one for the next week number:
3. Next, we want to get what the current week number is, so add a SharePoint "get items" action and in the Order By field type WeekNumber desc and set the Top Count field to 1:
4. Next, even thoiugh we are only bringing back 1 item you neverthelss need add an apply to each and select value from the dynamic content box (if you don't do it Powwer Automate will add it for you). Add a compose action and for the Inputs field select WeekNumber from the dynamic content box.
Next add 2 Set variable actions. For the first one set the value to be the outputs of the previous compose which you select from the dynamic content box. For the second one click in the Value field and select the Expression tab in the dynamic content box enter add(variables('varCurrentWeekNumber'),1) which adds 1 to the current week variable and stores it in the next week number variable.
5. Next, we want to bring back from the list all those items where the week number equals the current week number variable. To do this add another get items action, open the advanced options and in the Filter Query field type WeekNumber eq '' and inside the single quotes select the current week number variable from the dynamic content box.
6. Add another apply to each control and make sure to selecdt the correct value from the get items 2 section of the dynamic content box.
Next, add a compose for the current items date column, and select Date
Next, add another compose and for this we'll add 7 days to the date in the compose above using the expression addDays(outputs('ComposeCurrentDate'),7)
7. Finally, add a SharePoint create item action. For the weeknumber field select the next week number variable. The weekday, PVV and UNI3 columns aren't changing so just select the appropriate one for each field from the dynamic content box. And for the date field select the outputs of the compose new date you added in the previous step.
When you run the flow it it will create a new equivalent item for next week for each of the items in the current week. This runs every 7 days but you could do it further ahead just by changing the comose new date expression.
Hope that helps.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- FraitaJan 18, 2023Copper ContributorOhh thanks!!
I didn't expect the full answer but it's working!!
Thank you so much Rob, appreciate that you take time to do a full guide for it!