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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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