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 / How declare a variable...
Power Apps
Unanswered

How declare a variable in text property

(0) ShareShare
ReportReport
Posted on by 104

Hello all,

 

Is there a way to declare a variable in a text or item property.

In my case, I use a ColumnChart and I directly create a table in Item property like it: 

 

 

 

 

Table(
 {
 val1: Value(inputText1.Text);
 val2: Value(inputText1.Text) * Value(inputText3.Text) * Value(inputText4.Text);
 };
 {
 val1: Value(inputText2.Text);
 val2: Value(inputText2.Text) * Value(inputText3.Text) * Value(inputText4.Text);
 }
)

 

 

 

 

It works, but to have not to repeat Value(inputText3.Text) * Value(inputText4.Text), I would like use a variable directly in the property, maybe like it :

 

 

 

localVar(coef; Value(inputText3.Text) * Value(inputText4.Text);;


Table(
 {
 val1: Value(inputText1.Text);
 val2: Value(inputText1.Text) * coef;
 };
 {
 val1: Value(inputText2.Text);
 val2: Value(inputText2.Text) * coef;
 }
);

 

 

 

 

But I don't find the solution to do it.

Is it possible ? If yes, could you help me ?

If no, I think the best way is to use a Set(_coef, ...) in each concerning inputText (3, 4, ...). No ?

 

Thank in advance.

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Charlie 

    I think what you're looking for here is the With function:

    With({coef:Value(inputText3.Text) * Value(inputText4.Text)};
     Table(
     {
     val1: Value(inputText1.Text);
     val2: Value(inputText1.Text) * coef;
     };
     {
     val1: Value(inputText2.Text);
     val2: Value(inputText2.Text) * coef;
     }
     )
    )
  • Charlie Profile Picture
    104 on at

    Perfect. Thank a lot.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard