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,"""","")
Solved! Go to Solution.
Solved my problem after reading this:
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,"""","")
Solved my problem after reading this:
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,"""","")
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
206 | |
70 | |
51 | |
49 | |
20 |
User | Count |
---|---|
261 | |
120 | |
85 | |
80 | |
68 |