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

Displaying image using 64base

Hello!

I have a ticket system application where they can add a picture. This picture gets saved to my SharePoint list using this code: 

Patch(
       'Foto''s Manco App',
       Defaults('Foto''s Manco App'),
       {Title: DataCardValue12.Text & " " & DataCardValue24.Text,
         ImageData: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")
       }
)

 It looks like this: https://gyazo.com/5c8b7dcb733b60d00e54b47038f592c2

I use: "AddMediaButton1.Media" to get the picture into the "UploadedImage1"

I then made a formula that would display the image but this does not seem to work anymore. 

LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)

I used this formula instead of "AddMediaButton1.Media", this code would check if there is a picture in the database, if there is not, get the picture using "AddMediaButton1.Media"

Code: 

If(LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData)= "", AddMediaButton1.Media, LookUp('Foto''s Manco App', Title= DataCardValue12.Text & " " & DataCardValue24.Text, ImageData))

 

How could I do this?

 

30 REPLIES 30

Hi @TimoMigchielsen :

The following are my detailed steps:

My data source:MyPhoto

Title-text

Photo-mutiple lines of text

1\add a form(Form2);

DataSource:

 

MyPhoto

 

Item:

 

Gallery1.selected

 

2\photo data card

Update:

 

var /*Var is my custom variable*/

 

3\add a addpicture control into photo data card

Image:

 

If(IsBlank(AddMediaButton1.Media), If(IsBlank(ThisItem.Photo),SampleImage,ThisItem.Photo), AddMediaButton1.Media)

 

4\Add a Button:

OnSelect:

 

Set(var,Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""",""));SubmitForm(Form2);Refresh(MyPhoto)

 

6.gif

Best Regards,

Bof

 

I am not using a gallery to show the pictures. I am using a lookup formula for that and because of that, it will always show the first picture that has been made with that name. 

Formula to look up the image

LookUp('Foto''s Manco App', Title= DataCardValue16.Text & " " & DataCardValue19.Text, ImageData)

So I guess we could change this formula around to take the last ID with that formula? @v-bofeng-msft  

How could I do this? @v-bofeng-msft 

Hi @TimoMigchielsen :

If you only need to modify the record with the highest ID, just replace the item attribute of the form with 

 

First(Sort('Foto''s Manco App',ID,Descending))

 

on the basis of the scheme I provided Off.

Best Regards,

Bof

I also need to check 2 textfields because that is the name of the image. These names will not be unique cause it is: projectname space ticket id 

example:  18037-31_3010 48

So whenever someone changes the picture, it will have the same but the ID of the row will be higher. I always want to take the latest picture. There must be a way to get the highest ID combined with the code to lookup the pictures, right? @v-bofeng-msft 

Community Support
Community Support

Hi @TimoMigchielsen :

Please try this code:

First(Sort(Filter('Foto''s Manco App',field1="XXX"&&Field2="XXXXX"),ID,Descending))

Best Regards,

Bof

I tried to put this code in my Image section:

 

First(Sort(Filter('Foto''s Manco App',DataCardValue16.Text & " " & DataCardValue19.Text),ID,Descending));
LookUp('Foto''s Manco App', Title= DataCardValue16.Text & " " & DataCardValue19.Text, ImageData)

 

This gives me an error, could you please explain where to put your code? @v-bofeng-msft  

I thought we could just use this code below and then get the highest ID of that lookup formula:

LookUp('Foto''s Manco App', Title= DataCardValue16.Text & " " & DataCardValue19.Text, ImageData)

So basically, this formula looks up: the title of datacardvalue16 with a space between and then datacardvalue19, and then takes the image. All we need to do is take the highest ID 

Hi @TimoMigchielsen 

1.JPG

Best Regards,

Bof

There is just one problem, you use a gallery and I use the UploadedImage with a LookUp formula, you are kind of confusing me now haha @v-bofeng-msft 

I tried to put it in the OnVisible of the screen, did not work

On the item attribude of the form I already have this:  SelectedItem

Hi @TimoMigchielsen :

Could you tell me if my description is correct:

  • The addpicture control is in the images_Card datacard.
  • the images_Card datacard is in a form.

In addition ,The gallery in my solution is only used to select records. Just change the item attribute of the form according to what I said, and this gallery can be deleted.

Best Regards,

Bof

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (75,925)