cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Post Prodigy
Post Prodigy

How can I re display my PenInput image?

I have saved a PenInput image to SQL, and then read that data back in.

This is my code to save the image:

 

 

UpdateContext(
    {
        varImage: Substitute(
            JSON(
                PenInput1_1.Image,
                JSONFormat.IncludeBinaryData
            ),
            """",
            ""
        )
    }
);
PPM_SaveSignature.Run(
    varImage,
    Text(
        Now(),
        "dd/mm/yyyy hh:mm:ss"
    ),
    gblAssetDetailID,Upper(
        Text(
            Now(),
            "mmm"
        )
    ),Year(Now())
);

varImage is passed to the Flow as a String. It is received by the SQL Stored Procedure as varchar(MAX) and saved as SQL Image datatype.

 

 

This is how I read it back:

 

 

ClearCollect(
    SignaturesCollection,
    PPM_FindSignature.Run(
        gblAssetDetailID,
        Year(gblDate),
        Upper(
            Text(
                Now(),
                "mmm"
            )
        )
    )
);
If(
    CountRows(SignaturesCollection) > 0,
    UpdateContext({locSignature: First(SignaturesCollection).Image});UpdateContext({locSignatureImageVisible:true}),
    UpdateContext({locSignature: Blank()});UpdateContext({locSignatureImageVisible:false})
);

 

 

There is no Default option for the PenInput control, so I am trying to redisplay my image using an Image control.

I have set the Image property of the Image control to the local variable locSignature, which should contain the image if one exists.

I can confirm that First(SignaturesCollection).Image has a value.

However, my variable locSignature appears to contain a whole First(SignaturesCollection) record.

I have also tried setting the Image property of the Image control directly to First(SignaturesCollection).Image. That didn't work either. The image remains empty? Is it something to do with that JSON conversion?

 

I also tried this suggestion from the community, but it did not work:

 

Substitute(First(SignaturesCollection).Image,"""","")

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
stapes
Post Prodigy
Post Prodigy

Solved my problem after reading this: 

Solved: Adding PenInput Image to SQL Server varbinary(max)... - Power Platform Community (microsoft....

 

In my SQL stored procedure, saved the image as datatype varchar(MAX) instead of Image.

To display the image back in the PowerApps:

Substitute(First(SignaturesCollection).Image,"""","")

 

 

 

View solution in original post

1 REPLY 1
stapes
Post Prodigy
Post Prodigy

Solved my problem after reading this: 

Solved: Adding PenInput Image to SQL Server varbinary(max)... - Power Platform Community (microsoft....

 

In my SQL stored procedure, saved the image as datatype varchar(MAX) instead of Image.

To display the image back in the PowerApps:

Substitute(First(SignaturesCollection).Image,"""","")

 

 

 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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