Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

TextInput condition startswith

(0) ShareShare
ReportReport
Posted on by 395

Hi, Im trying to set a variable based on the content of  a textinput. I have the textinput default set to a Image control which returns the base64. Rather then put all the base 64 in below. Is there a way i can shorten it up with,  If(Startswith(TextInput10.Text, "data:image/svg+xml", Set(Var......?

 

 

If(TextInput10.Text = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNv........", Set(VarPDFImage2, JSON(Base64_Blank.Image, IncludeBinaryData)), Set(VarPDFImage2, JSON(Base64_Img2.Image)))

Categories:
  • Re: TextInput condition startswith

    Hi , @Matt383 

    It seems work good in my side ? Can you show a screenshot what the value return in your side after you click the button?

    vyueyunmsft_0-1713249149868.png

     

     

     

    Best Regards,

    Yueyun Zhang

     

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: TextInput condition startswith

    I want the VarPDFImage2 to set to a blank image (Base64_Blank.Image)  if  the Textinput10 starts with "data:image/svg+xml"

    If the TextInput10 starts with anything else, i want the VarPDFImage2 to set the image to Base64_Img2.Image

  • Re: TextInput condition startswith

    Hi , @Matt383 

    What do you want to set to the VarPDFIMage2? In my side , it can return value:

    vyueyunmsft_0-1713247963187.png

     

    Best Regards,

    Yueyun Zhang

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: TextInput condition startswith

    No errors with the code however the variable is not working anymore (The set VarPDFIMage2, JSON(Base64_Blank.Image.....)

  • Re: TextInput condition startswith

    Hi , @Matt383 

    Please try to use this code:

    If(StartsWith(TextInput10.Text, "data:image/svg+xml"), Set(VarPDFImage2, JSON(Base64_Blank.Image,JSONFormat.IncludeBinaryData)),Set(VarPDFImage2, JSON(Base64_Img2.Image,JSONFormat.IncludeBinaryData)) );
     

    Best Regards,

    Yueyun Zhang

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: TextInput condition startswith

    Matt383_0-1713245886130.png

    Invalid number of arguments: received 4 expected 2

     

  • Re: TextInput condition startswith

    Hi , @Matt383 

    Sorry , what do you mean that "receive arguments" , can you show your screenshot  and give me an example what you want to get in your side?

     

    Best Regards,

    Yueyun Zhang

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: TextInput condition startswith

    Hi Yueyun, yes. I have already tried 

    If(Startswith(TextInput10.Text, "data:image/svg+xml", Set(VarPDFImage2, JSON(Base64_Blank.Image, IncludeBinaryData)), Set(VarPDFImage2, JSON(Base64_Img2.Image)))

     

    however receive arguments

  • Re: TextInput condition startswith

    Hi, @Matt383 

    Do you mean you want to use the startswith() function as the judgement?

    If(Startswith(TextInput10.Text, "data:image/svg+xml", Set(VarPDFImage2, JSON(Base64_Blank.Image, IncludeBinaryData)), Set(VarPDFImage2, JSON(Base64_Img2.Image)))

     

    Best Regards,

    Yueyun Zhang

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard