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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,136)