cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Klelyah
Regular Visitor

If dans une fonction Text

Bonjour à tous,

 

Je ne comprends pas pourquoi ma fonction IF ne fonctionne pas dans le champs Text d'une gallery.

 

En gros j'ai une gallery qui importe des données depuis une liste SharePoint. Dans ces données il y en a une qui est en pourcentage et j'aimerais lui dire de ne pas m'afficher des -300.65 % mais plutôt de mettre "A venir" et au lieu du +1236% mettre "Terminée" et bien sûr entre afficher simplement le pourcentage.

J'ai tester plein de choses de différente manière mais il ne semble pas prendre le If.

 

Peut être me trompes-je de champ ?

 Dans l'image ci dessous la fonction est fonctionnel mais non complète je n'arrive pas à ajouter des conditions pour les nombres supérieur à 100 ou inférieur à 0

2022-05-04_17h57_42.png

 

Merci d'avance de votre aide !

18 REPLIES 18

Je ne suis pas sûre d'avoir compris où je dois le mettre dans ce que tu m'as dit donc voilà où je m'acharne a essayé de le mettre 

 

2022-05-05_14h39_43.png

Je ne s uis pas sûre d'avoir compris ce que tu m'as dit donc ci dessous tu verras là où je m'acharne à mettre ma formule

 

2022-05-05_14h39_43.png

Silvester
Super User
Super User

Xa a marche?

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.
Silvester
Super User
Super User

Jt'envoies un message prive. Il y' a un souci de datatype, je crois c'est de la que vient l'erreur

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.
Klelyah
Regular Visitor

Personne n'aurai de solution ? 😞

analmei
Community Support
Community Support

Hello @Klelyah ,
 
As I can understand, you want to set values in a gallery dependent on the range returned by "ThisItem.Progress". If the values are between 0 and 100, you want to show the values with two decimal positions. 
 
The best option here is to use the Round function, instead of Left. Left is for string and round is to number. 
Let me share the documentation about the Round function: https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-round
 
My suggestion is the following:
 
Switch(
ThisItem.Progress, < 0; "Coming  soon";
                   > 100; "Completed";
Round(ThisItem.Progress; 2) & "%"
)
 
Let me know if the action plan works for you. 🙂
 
Best regards,

Ana Almeida | Power Platform Support Engineer

analmei
Community Support
Community Support

Hello @Klelyah , 

 

As I can understand you want to set values in a gallery dependent on the range returned by "ThisItem.Progress". If the values are between 0 and 100, you want to show the values with two decimal positions. 

 

The best option here is to use the Round function, instead of Left. Left is for string and round is to number. 

Let me share the documentation about the Round function: https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-round

 

My suggestion is the following:

 

Switch(
ThisItem.Progress, < 0; "Coming  soon";
                   > 100; "Completed";
Round(ThisItem.Progress; 2) & "%"
)

 

Let me know if the action plan works for you. 🙂

Hi,

 

Thanks for your answer, but it's not working :

 

Klelyah_0-1653399781365.png

 

analmei
Community Support
Community Support

@Klelyah 

We can’t use the switch since we don’t have an array.

To put this working as expected I used the following logic:

 

If(

    ThisItem.percentages <= 0,

    "Comming soon",

    If(

        ThisItem.percentages >= 100,

        "Completed",

        Round(ThisItem.percentages, 2) & "%"

    )

)

 

Let me know if works for you.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,200)