cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Impactful Individual
Impactful Individual

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
Impactful Individual
Impactful Individual

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
Impactful Individual
Impactful Individual

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,123)