cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RoScha
Helper V
Helper V

Incorrect ID of the signature is displayed

Hello community,

I'm using this code here to save a signature as an image in a SharePoint library.

 

Set(
    varJson;
    JSON(
        pen_Unterschriftsfeld.Image;
        JSONFormat.IncludeBinaryData
    )
);;
Set(
    varJson;
    Mid(
        varJson;
        24;
        Len(varJson) - 24
    )
);;
flow_Unterschrift_Bild_SP.Run(varJson);;
Set(
    _sig_save;
    true
);;
Set(
    _sig_id;
    First(
        Sort(
            Unterschriftsbilder;
            ID;
            Descending
        )
    ).ID
)

 

But now I have the problem that the _sig_id is not displayed correctly here. It does not show me the ID last created, but the ID (minus 1) is shown to me. (Example: the new image of the signature has the ID 10, but the ID 9 is displayed). I have a suspicion that there is a timedelay here.

 

How do I get the correct ID of the image to be displayed here?

 

And as always: Thanks for your help.

 

Best regards

RoScha

6 REPLIES 6
RandyHayes
Super User
Super User

@RoScha 

You are not waiting for your flow to complete.

 

Set the line of your Formula with the Flow to:

Set(flo_res; flow_Unterschrift_Bild_SP.Run(varJson));;

This way your PowerApp will wait for the flow to complete.  Otherwise it will trigger the flow and just move on to the next portion of your Formula.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hello @RandyHayes 

I tried your formula but the ID minus 1 still comes out and not the last one created.

Do you have any ideas what I can do here?
This is what my code currently looks like:

Set(
    varJson;
    JSON(
        pen_Unterschriftsfeld.Image;
        JSONFormat.IncludeBinaryData
    )
);;
Set(
    varJson;
    Mid(
        varJson;
        24;
        Len(varJson) - 24
    )
);;
Set(flo_res; flow_Unterschrift_Bild_SP.Run(varJson));;
Set(
    _sig_save;
    true
);;
Set(
    _sig_id;
    First(
        Sort(
            Unterschriftsbilder;
            ID;
            Descending
        )
    ).ID
);;Back()

 

Best regards

RoScha

RandyHayes
Super User
Super User

@RoScha 

Sorry, also forgot to mention...if you have something that is changing your datasource (your Flow in this case), you will need to refresh the Datasource in your app in order for the session table to get the changes.

This is a costly function to perform, but there is no other way if your flow is creating a new record.

You might want to consider trying to do the function of the Flow in your app if possible.  If not, then a refresh is needed.

Set(flo_res; flow_Unterschrift_Bild_SP.Run(varJson));;
Refresh(Unterschriftsbilder);;
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes you write: "You might want to consider trying to do the function of the flow in your app if possible."

This function creates a picture of a signature in the SP.

 

How can I create this image in the app?

RandyHayes
Super User
Super User

@RoScha 

Yeah, you're not going to be able to do that directly.  But, I am not sure your purpose on the ID.  If it is for somehow using in another record to store the signature ID, then you might instead want to consider having your flow return the ID of the record that it just created.  Then you will have this in your app to use for the next.

Keep in mind though that relying on these types of methods means that your app will need to pretty much be a single user app - because, if User A does this and the ID is 20 and you assume then the next is 21.  If User B does the same they the flow would return 21 and now their app thinks the next is 22.  But, back to User A, they still "think" the next ID is 21...but User B just created that.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes you are absolutely right. With person A and B that could be a problem.

 

You write "...If it is for somehow using in another record to store the signature ID, then you might instead want to consider having your flow return the ID of the record that it just created..." And here is my problem.

I've only been doing PowerApps for a good six months, and I've never done anything with Flow. I created the flow with the help of a website, but I have no idea how I can get an ID via flow and then return this ID to the app.

 

Do you have a tip for me?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,849)