cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WO1
Helper I
Helper I

Cannot Convert Record Value to Text/Number

I have a Sharepoint List called ItemTotals in which I am attempting to look up a value based on a matching string, set that value to a variable. For the sake of this post, I assume I always return 1 record result, so no need to use FIRST or any type of record logic.

 

I've tried setting the actual field (currentCount) which is a number to the iCurrentQty Variable in order to make it a text type so I could then convert it to an int. My end result I'm trying to achieve for the currentQty is an Int. Any idea what I'm doing wrong here? Using  Value(iCurrentQty) after setting the variable gives me an error stating it requires a number / text  which makes me thing its still treating that as a record even though I called the specific column name.

 

Set(iCurrentQtyList,Filter(ItemTotals,Title = Dropdown1.SelectedText.Value));
Set(iCurrentQty,iCurrentQtyList.CurrentCount);
Set(iChangeQty, Value(DataCardValue10.Text));

 

--What I want to do eventually but need to cast the iCurrentQty to an int
Set(iNewQty, iCurrentQty + iChangeQty);

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@WO1 

Please consider changing your Formula to the following:

Set(iNewQty, LookUp(ItemTotals, Title = Dropdown1.Selected.Value, CurrentCount) + Value(DataCardValue10.Text))

 

Your iNewQty will contain a numeric value of the sum of the existing record count and the new entered count.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@WO1 

Please consider changing your Formula to the following:

Set(iNewQty, LookUp(ItemTotals, Title = Dropdown1.Selected.Value, CurrentCount) + Value(DataCardValue10.Text))

 

Your iNewQty will contain a numeric value of the sum of the existing record count and the new entered count.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Perfect, Exactly what I needed. I should have used Lookup initially to get a discrete value rather than filter to get a record result.

 

Thanks for the help.

@WO1 
Please mark the solution written by @RandyHayes if your issue if solved.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,133)