web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Answered

Functions - I GIVE UP

(0) ShareShare
ReportReport
Posted on by 21

As a relative newbie to Power Automate or at least at best a novice I think I am trying to bite of more than I can chew.

 

I am trying to create a function that will create a 4 digit figure based on the ID of an item in a SharePoint list. I.E. if the ID of the item is in the list is 101 then I want a calculated column to return 1101.

 

The function I have entered that is not working is - add(triggerBody()?['Unique_x0020_ID'],0001)

 

The complete flow is as shown below:

RobinWhite5133_0-1706192002060.png 

 

Each of the above steps in detail are:

 

When an item is created

RobinWhite5133_6-1706192476267.png

 

Update Item

RobinWhite5133_7-1706192498266.png

Folder Name

RobinWhite5133_8-1706192539422.png

 

Create New Folder

RobinWhite5133_9-1706192574524.png

 

Create sharing link for a file or folder

RobinWhite5133_10-1706192606427.png

 

Update Item 2

RobinWhite5133_5-1706192396598.png

 

Can anyone in the Power Automate community see where I am going wrong.. Many thanks.

 

 

Categories:
I have the same question (0)
  • TYL Profile Picture
    1,091 Super User 2024 Season 2 on at

    Hi @RobinWhite5133 ! Instead of "add" try the Concat() function. Add is for calculations, concatenate is for your specific use case which combines values with each other!

  • TYL Profile Picture
    1,091 Super User 2024 Season 2 on at

    @RobinWhite5133  If u want 1+SharepointID it would be something like concat('1',triggerBody()?['Unique_x0020_ID']).

  • RobinWhite5133 Profile Picture
    21 on at

    Hi Tjan

    I have done as you suggested which has moved me on a touch. However I cannot see why ID 3 is producing a unique ID of 31 and not 1003 and when I use that field in the Task Name it is producing all those 000000's when all I want is 10003. Any idea's. Also how would I prefix the Unique ID with the following 'ACE-'

    RobinWhite5133_0-1706195882149.png

     

  • New-AzGuru Profile Picture
    179 on at

    "The function I have entered that is not working is - add(triggerBody()?['Unique_x0020_ID'],0001)"

    If the first 2 responses didn't help you, can you let us know if you are getting an error message?  Or is the flow just not behaving as expected? 

     

    If I plug in your expression (assuming triggerBody()?['Unique_x0020_ID'] is equal to 101), then the first example shows that it might just be a math error.  I'm including the concat values along with another add statement to assist.

     

    Also, never give up!  Just take a break to clear your head and come back strong later!  We've all been there!

     

    NewAzGuru_0-1706196103840.png

     

  • New-AzGuru Profile Picture
    179 on at

    Oh and to add a prefix, just throw another concat function around your current snippet:

    NewAzGuru_0-1706197001378.png

     

  • RobinWhite5133 Profile Picture
    21 on at

    Getting closer, but still have the spurious 00000's appearing when the Task Name is updated & the Folder name created.

     

    In regards to the ACE prefix, when I alter the Compose 3 to concat('ACE-',add(101, 1000)) I get the error below, however when I leave it as add(101, 1000)) it runs fine apart from that it does not update the Unique ID by 1.

     

    The 'inputs.parameters' of workflow operation 'Update_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/UniqueID0' is required to be of type 'Number/double'. The runtime value '"ACE-1101"' to be converted doesn't have the expected format 'Number/double'.

     

    I thought this would be simple.... 😄

  • TYL Profile Picture
    1,091 Super User 2024 Season 2 on at

    Hi @RobinWhite5133  You're almost there, hang on there! You get the error because your output is not a number. This has to do with the column type you chose. I think you have it as number now. If you really want it to have the ACE in it, you can try to change to column type to string in Sharepoint. Then it will accept ACE-1101 (and all similar variants )

  • RobinWhite5133 Profile Picture
    21 on at

    Tjan, it's looking a lot better now. The final problem I have is that the Unique ID I need creating is not increasing by 1 every time a new item is submitted. Basically, I have created a number column call 'PAID' which takes the SharePoint ID of the item in the list creates the 4 figure 'PAID' (1000+SharePoint ID of the item) which in turn creates the Unique ID with the Prefix. ACE-1012.

     

    I hope that make sense. Any ideas?

    RobinWhite5133_1-1706267771715.png

     

     

     

     

     

    Any ideas?

  • TYL Profile Picture
    1,091 Super User 2024 Season 2 on at

    @RobinWhite5133 Can you double check whether the Sharepoint ID is really provided in the PAID? If you want, you can share the expression. I can check for you 😁

  • RobinWhite5133 Profile Picture
    21 on at

    Tjan, I don't know how but I have managed to do it... Many thanks for all your help with this problem. I've added you as a friend (hope you don't mind). Again many thanks you are a superstar... 😀

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard