Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

ClearCollect from Sharepoint List adding Decimals to Numbers

(0) ShareShare
ReportReport
Posted on by

I have a Sharepoint list set up as a Data Source in a PA App and I'm doing a simple ClearCollect into a Collection to gather this data for manipulation : 

Powertron_0-1681403659017.png

The Sharepoint List has a Lookup Column, SupplierID, which displays as follows : 

Powertron_1-1681404038921.png

It pulls from a list called "Suppliers" and takes the "SupplierID" value from that list : 

Powertron_2-1681404094146.png

I mention all this just because this is the only thing I can think of that might be causing this weird issue.  Despite the value showing here as "97", if we look at the collection in PowerApps : 

Powertron_3-1681404277981.png

I've no idea why it gives a seperate ID/Value, but that can be worked around by using SupplierID.Value.  However this produces an output of 97.000000000000 instead of 97 as expected, which is causing issues in my App. 

 

Any idea how to work around this?

Categories:
  • Ygor Profile Picture
    Ygor 44 on at
    Re: ClearCollect from Sharepoint List adding Decimals to Numbers

    hi @Powertron,

     

    Looking at your explanation, I couldn't spot any errors, your reasoning is correct. I think the collection "colSupplierContact" can have only 1 record. Maybe this is the problem, look in collections of your app and verify how many records colSupplierContact have. I'm a little bit curious if this is the error.

  • Powertron Profile Picture
    Powertron on at
    Re: ClearCollect from Sharepoint List adding Decimals to Numbers

    My numbers are all whole numbers, between 1 and 4 digits, should not contain any decimals.  I think I might be having another issue to be honest, as I think I've got the formatting sort of working, but I'm getting the wrong results.

     

    I have a gallery built off the "Suppliers" Sharepoint as follows : 

    Powertron_0-1681464445413.png

    The "Suppliers" button feeds into a variable : 

    Powertron_1-1681464473838.png

    This is used by a second table which is fed from the "Supplier Contacts" table, and its supposed to use the SupplierID value to select all the supplier contacts for each supplier, when I click the "Suppliers" button.  

    There is a text box at the top that indicates the Supplier Name and the number of Contacts the supplier has, and that illustrates the issue I'm having : 

     

    Powertron_2-1681464798012.png

    So the first part works fine, the supplier name is contained in my "Suppliers" list and is collected into the "colSuppliers" collection, from which it is correctly identified.

    The issue is the second part.  This particular supplier has 4 contacts, as you can see its listing one.  It IS listing one of the 4 contacts which are assigned to this supplier in my gallery however, using this code : 

    Powertron_3-1681464928218.png

    (yes I know there is a delegation issue, I actually usually pivot off another hidden gallery to avoid this, I've just bypassed that for ease of explanation here).  

    This only lists one of the four entries in the colSupplierContact list, and I cannot for the life of me work out why.

    Powertron_4-1681465023065.png

    From the code I can see it correctly knows that the varSupplierContact.SupplierID value is 62 : 

    Powertron_5-1681465078970.png

    So I can't figure out why this isn't working.

  • mmollet Profile Picture
    mmollet 3,187 on at
    Re: ClearCollect from Sharepoint List adding Decimals to Numbers

    As @Ygor said this can be handled by some simple text formatting. This is another of many examples as to why complex columns are an issue in Power Apps. There are ways to not have to use them and they genreally making creating a functioning app much more simple. The easiest way to format this is by using the Text function:

    Text([number/text to format], "formatting")

    Tips

    "#.##" and your value is 0.40 it will display .4

    "0.#0" and your value is 0.40 it will display 0.40

    # means show any non-zero number in this spot while 0 means show any non-zero number in this spot and if there isnt one then add a 0. This is how you get leading or trailing 0s to show. 

    "0000.0000" and your value is 1.58 with display 0001.5800 for example. Hope this helps!

  • Ygor Profile Picture
    Ygor 44 on at
    Re: ClearCollect from Sharepoint List adding Decimals to Numbers

    Hi @Powertron,

     

    Searching about this, I found this topic, basically, this is a known issue with SharePoint calculated fields. They fixed it in some ways.

     

    Round(Value(Parent.Default),2)

     Or

    Text(Value(Parent.Default),"[$-en-US]#.0")

    Or

    Text(Value(Parent.Default), "#.00")

     

    I used the third formula and it worked in my app.

    If this solves your question, would you be so kind as to accept it as a solution.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard