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 / Saving a Number as a S...
Power Apps
Suggested Answer

Saving a Number as a String in Sharepoint from a canvas app.

(0) ShareShare
ReportReport
Posted on by 168
I have a SharePoint field I wish to store the minutes of a time. Because it can be 00 or 05 I have made the field a string:

This works fine if I enter the data straight into the list:

However, when I save the value from my Canvas App, even forcing the value to be a string as follows:
Patch(
    Offices, 
    Offices_Gal.Selected, 
    {
        Timezone:
        {
            Value: Timezone_Combo.Selected.Timezone,
            Id:
            LookUp(
                Timezones,
                ID=Timezone_Combo.Selected.ID
            ).ID
        },
        HH: Value(HH_Combo.Selected.Value),
        MM: Value(Right(Concatenate("00", MM_Combo.Selected.Value),2))
    }
);
It always results in it being converted to a number, e.g:

or

Additionally, there is no number in the combo box that is being selected either. Everything is a string:

It just wants to convert numeric strings to numbers.
Does anyone have any Idea how to force this?
Categories:
I have the same question (0)
  • Lisa3 Profile Picture
    46 on at
    If you want it to go into the list as a string, you don't need to convert it to a value.  Try patching it like this and it should show both characters in the list:
    {MM: MM_Combo.Selected.Value}
  • AngusWalker Profile Picture
    168 on at
    @lisa3 That's where I initially started from.
    I forced it to a string because the basic {MM: MM_Combo.Selected.Value} always saves it as a number.
  • Suggested answer
    SebS Profile Picture
    4,592 Moderator on at
    Hi,
     
    You wrap HH_Combo.Selected.Value in Value() <--- this function will change String to a number if the string represent number just drop the Value() and you will be ok if you want to force something to become String you cast it as Text()
     
    Patch(
        Offices, 
        Offices_Gal.Selected, 
        {
            Timezone:
            {
                Value: Timezone_Combo.Selected.Timezone,
                Id:
                LookUp(
                    Timezones,
                    ID=Timezone_Combo.Selected.ID
                ).ID
            },
            HH: HH_Combo.Selected.Value,
            MM: Right(Concatenate("00", MM_Combo.Selected.Value),2)
        }
    );

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