web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / TextInput condition st...
Power Apps
Unanswered

TextInput condition startswith

(0) ShareShare
ReportReport
Posted on by 407

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:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    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
    407 on at

    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

  • v-yueyun-msft Profile Picture
    on at

    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
    407 on at

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

  • v-yueyun-msft Profile Picture
    on at

    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
    407 on at

    Matt383_0-1713245886130.png

    Invalid number of arguments: received 4 expected 2

     

  • v-yueyun-msft Profile Picture
    on at

    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
    407 on at

    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

  • v-yueyun-msft Profile Picture
    on at

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 401

#2
WarrenBelz Profile Picture

WarrenBelz 334 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 325 Super User 2025 Season 2

Last 30 days Overall leaderboard