Skip to main content
Community site session details

Community site session details

Session Id : 5vQUAJIkcn2nfOAbTGBto3
Power Apps - Building Power Apps
Answered

How to convert a number into a text in order to use a Search function ?

Like (0) ShareShare
ReportReport
Posted on 3 May 2022 12:08:03 by 155

Hello all,

 

I have this formula  in my DataTable:

 

If(varRole = "Contrôleur";

     Search(
         Filter(
           T04_Weekends;
         And(
          And(
           Society in Filter(
           Usersrole;
           cr5e7_email = varUser
          ).cr5e7_society;
           varRole = "Artist"
          );
         'Statut' = "New" && Date >= (dpFromWeekendControleur.SelectedDate) && Date <=              (dpToWeekendControleur.SelectedDate)
         )
         );
inpSearchBox_9.Text;

"cr5e7_name";
"cr5e7_statut";

Text("cr5e7_number")

);

 

However, my formula doesn't work because of  "Text("cr5e7_number") which is a number in my Dataverse column.

I would like to know how can I use Search with a field of Number type, please without to create a collection if it's possible.

T04_Weekends is a table, "cr5e7_name", "cr5e7_statut" are two fields of my table.

 

Many greetings.

 

Samuel

 

Categories:
  • Samny_98 Profile Picture
    155 on 06 May 2022 at 08:05:06
    Re: How to convert a number into a text in order to use a Search function ?

    @WarrenBelz 

     

    I have no error with your formula but it doesn't work.

    The value of Statut field doesn't change.

    I didn't have an ID column. Thus, I created an ID column which is a number type....

  • Verified answer
    WarrenBelz Profile Picture
    148,929 Most Valuable Professional on 05 May 2022 at 20:50:21
    Re: How to convert a number into a text in order to use a Search function ?

    Hi @Samny_98 ,

    Same issue - please take a moment to understand what has happened as it will help you greatly in the future,

    Patch(
     T04_Weekends;
     {ID: DataTable2_5.Selected.ID};
     {'Statut ': DataCardValueStatutWeekend_2.Selected.Value}
    )

     

    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.

    Visit my blog Practical Power Apps

  • Samny_98 Profile Picture
    155 on 05 May 2022 at 15:05:44
    Re: How to convert a number into a text in order to use a Search function ?

    @WarrenBelz 

    I have in my Save Button in order to update Statut field in my DataTable.

    Switch(
         Text(DataCardValueStatutWeekend_2.Selected.Value);
         "VALIDATED";
          Patch(
            T04_Weekends;
            DataTable2_5.Selected;
        {
           'Statut ': "VALIDATED"
       }
       );
          "ASSIGNED";
            Patch(
             T04_Weekends;
             DataTable2_5.Selected;
           {
             'Statut ': "ASSIGNÉ"
          }
        );
    "ANOMALY";
    Patch(
    T04_Weekends;
    DataTable2_5.Selected;
    {
    'Statut ': "ANOMALY"
    }
    )
    );;

     

    If I have in my DataTable, the Search function with number fields, how do I change my formula on the Save button in order to make my Patch function with my DataTable (DataTable2_5.Selected) please ?

    CaptureAnglais.PNG

     

  • WarrenBelz Profile Picture
    148,929 Most Valuable Professional on 04 May 2022 at 20:48:16
    Re: How to convert a number into a text in order to use a Search function ?

    Hi @Samny_98 ,

    That is not what I posted - you need the ID if you want the unique identifier for the record, however if Status is in the Data Table, then that should work, except it will find the first matching record only. I did notice however you have Statut in your code. All of that however is irrelevant to your Patch - you have not provided that code.

  • Samny_98 Profile Picture
    155 on 04 May 2022 at 13:05:56
    Re: How to convert a number into a text in order to use a Search function ?

    @WarrenBelz 

     

    Your formula doesn't help me.  I wanted just to update the values of some fields with Patch. I try to make your formula in the Item Property of my form :

    LookUp(

      T04_Weekends;

    'Status' = DataTable2_5.Selected.'Status'

    )

    However, I have an error.

    Sorry to disturb you and thanks for your help !

     

  • WarrenBelz Profile Picture
    148,929 Most Valuable Professional on 04 May 2022 at 12:08:32
    Re: How to convert a number into a text in order to use a Search function ?

    Hi @Samny_98 ,

    I am saying you can no longer use DataTable2_5.Selected as it contains an additional column not in the list the form Item is based on (so the selected record contains a field the form cannot deal with).

    I have noticed you are using a Data Table, not a Gallery and the code I posted will not work as there is no OnSelect property. A bit less efficient, but you could make the Item of the Form

    LookUp(
     SPListName,
     ID = DataTable2_5.Selected.ID
    )

     

    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.

    Visit my blog Practical Power Apps

     

  • Samny_98 Profile Picture
    155 on 04 May 2022 at 11:56:01
    Re: How to convert a number into a text in order to use a Search function ?

    @WarrenBelz 

     

    Thanks ! However, I don't  understand well your explanation.

    In my formula (On Select Property), of the Save Button which is out of my form , I try to add Set(MyNewDataTable;DataTable2_5.Selected) at the beginning and I changed DataTable2_5.Selected to MyNewDataTable) but I have the same error. 

     

    I just tried to change the .Selected to MyNewDataTable in the Patch...

     

    In my app, I have just a DataTable with a DataSource T04_Weekends where I want to display the number fields,

    a form with several fields and a Save Button.

    I showed you previously my formula for the Save Button.

     

  • WarrenBelz Profile Picture
    148,929 Most Valuable Professional on 03 May 2022 at 21:09:07
    Re: How to convert a number into a text in order to use a Search function ?

    Hi @Samny_98 ,

    When you use AddColumns for a Gallery or Data Table, you can no longer use .Selected as the Item of a Form selected from it as the Data Source (the list) does not contain this field. You need a different approach (which is probably better anyway) - OnSelect can be

    Set(
     gblID,
     ThisItem.ID
    )

    and then the Form Item

    LookUp(
     SPList,
     ID = gblID
    )

     

    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.

    Visit my blog Practical Power Apps

     

  • Samny_98 Profile Picture
    155 on 03 May 2022 at 14:06:19
    Re: How to convert a number into a text in order to use a Search function ?

    @WarrenBelz 

     

    Your formula works for my DataTable but I have an issue with a bouton which updates the Status of my DataTable which has many errors.

     

    The button's formula :


    Switch(
         Text(DataCardValueStatutWeekend_2.Selected.Value);
         "VALIDATED";
          Patch(
            T04_Weekends;
            DataTable2_5.Selected;
        {
           'Statut ': "VALIDATED"
       }
       );
          "ASSIGNED";
            Patch(
             T04_Weekends;
             DataTable2_5.Selected;
           {
             'Statut ': "ASSIGNED"
          }
        );
    "ANOMALY";
    Patch(
    T04_Weekends;
    DataTable2_5.Selected;
    {
    'Statut ': "ANOMALY"
    }
    )
    );;

     

    I have this error : "The Patch function has invalids arguments.

    The specified column "cr5e7_no" doesn't exists . I try to add this column in my DataTable. However, I always have an error.

    If I change of DataTable, it works. Thus, the issue comes from of my DataTable (for example Datable1.Selected instead of DataTable2.5.Selected) in my formula...

     

     

     

  • Samny_98 Profile Picture
    155 on 03 May 2022 at 12:28:59
    Re: How to convert a number into a text in order to use a Search function ?

    Ok thanks ! @WarrenBelz 

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

Announcing our 2025 Season 2 Super Users!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete