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 / Problem setting Variab...
Power Apps
Answered

Problem setting Variable to concatenation of text and date field

(0) ShareShare
ReportReport
Posted on by 49

I have created a button on my PowerApps form that is linked to a sharepoint list which 'on select' sets the variable as follows

Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"ddmmyyyy"))})

It seems to work OK as the result under formula bar is "New_27012021"

The problem is when I focus on another element in the form and then return to the button the formula has been changed automatically to 

Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"[$-en-AU]ddmmyyyy"))}) which no longer provides a  date value ie the result displayed under the formula bar is "New_"

Any suggestions re a fix would be appreciated

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,059 Most Valuable Professional on at

    Hi @jb007 ,

    Yes some of us live in Oz and get used to this one - annoying though it is. Just change it to

    Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"[$-en-US]ddmmyyyy"))}) 

    and all will be well from then on.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • jb007 Profile Picture
    49 on at

    You misunderstand my problem: My issue is that Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"[$-en-US]ddmmyyyy"))}) gives a "New_" result ie the selected date part is blank. ie it doesn't give the correct result

    If I initially use just  "ddmmyyyy" rather than "[$-en-US]ddmmyyyy" the formula bar indicates a correct value of for example "New_21012021" but as soon as I move from the button and focus on another form object then move back to the button the formula has been changed by PowerApps to Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"[$-en-US] which gives the incorrect result "New_" ie with a blank date part.

  • Verified answer
    WarrenBelz Profile Picture
    153,059 Most Valuable Professional on at

    HI @jb007 ,

    Your initial post said it changes to 
    Set(varRef,{Value:Concatenate("New_",Text(DataCardValue24.SelectedDate,"[$-en-AU]ddmmyyyy"))}) from [$-en-US] initially. This is a common annoyance I get and the reference in this case simply needs to be changed to  [$-en-US] and saved.

    If the issue is different and you are saying the Variable changes value, try putting a label with the Text value varRef and see if the value changes as you move around your elements. If it does not, then there may not be an issue.

    Happy to assist further if required.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

  • jb007 Profile Picture
    49 on at

    Apologies Warren,

    Suffering from not failure to read the detail. All sorted now Thanks

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
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard