cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jasmin_Sch
Helper IV
Helper IV

Sum function in gallery/collection causes errors

Hi!

 

I am facing some issues with the sum function within in my gallery.

 

For the background:

 

I create a collection with lines which should be patched with number columns in sharepoint afterword.

 

ClearCollect(

    Tätigkeiten;ForAll(Sequence(3);

    {

        LineGJ21Q1APV:"0";LineGJ21Q2APV:"0";

        LineGJ21Q3APV: "0";

        LineGJ21Q4APV: "0")

 

 

ForAll(

    'Gallery Neues Arbeitspaket Tätigkeit'.AllItems;

    Patch(

        '3400 ILLU Arbeitspakete O3.4';

        Defaults('3400 ILLU Arbeitspakete O3.4');

        {

            GJ21Q1APV: Value('Input GJ21Q1'.Text);

            GJ21Q2APV: Value('Input GJ21Q2'.Text);

            GJ21Q3APV: Value('Input GJ21Q3'.Text);

            GJ21Q4APV: Value('Input GJ21Q4'.Text)}))

 

The inputs inside my gallery (data source is my collection “Tätigkeiten”) are Text inputs.

 

But I want to sum them. So I put text inputs inside my gallery with default property Sum('Input GJ21Q1';'Input GJ21Q2').

 

But after I have run the app and review its performance it says errors: This value can not be converted into a number because value consists of empty string.

 

 

I tried a lot of things like changing from text input to number input. I changed the clear collect function to this:

 

ClearCollect(

    Tätigkeiten;ForAll(Sequence(3);

    {

        LineGJ21Q1APV;0LineGJ21Q2APV:0;

        LineGJ21Q3APV: 0;

        LineGJ21Q4APV: 0)

 

But nothing works to avoid these errors.

 

Please help me with this!

 

 

Thank you very much5E00998E-C447-46E0-B4DD-23E045F84D41.jpeg

6 REPLIES 6
_Nils_
Advocate I
Advocate I

Hi,

I think converting the textinputs into numbers within your sum function should work.

Does this work for you? :

Sum( Value( 'Input GJ21Q1'.Text); Value( 'Input GJ21Q2'.Text))

 

Also, if these labels are inside a gallery you would have to use: ThisItem. 'Input GJ21Q1'.Text

Thank you @_Nils_ 

 

no it does not work

 

Just for summary

this my function to create a collection

ClearCollect(

    Tätigkeiten;ForAll(Sequence(3);

    {

        LineGJ21Q1APV:"0";LineGJ21Q2APV:"0";

        LineGJ21Q3APV: "0";

        LineGJ21Q4APV: "0")

text inputs with default ThisItem.LineGJ21Q1

 

The summary Input is also a text Input but it does not make a difference if I change it to number.

Could you give some more information about what you are trying to accomplish and when the error occurs exactly?

As far as I understand, you are creating a collection "Tätigkeiten" which is displayed in a gallery.
In this gallery you have textinputs showing the values of each column (using ThisItem.* as default) as well as a textinput which is suppost to sum all the values from the collection for each line (using Sum(ThisItem.*; ThisItem.*)).

Is this correct? When does the error occur exactly? Could you share a screenshot and brief description?

@_Nils_ Of course thank you for your help

 

It says: Value can not be converted into number because value is an empty string.

9429520D-9CF0-4E6D-AC38-FD9E2DD89918.jpegBD43CF01-50FA-4A69-ABDF-FFC410FFC45D.jpeg9CAD1BFE-BB33-4C63-9C19-1EF5EF79229E.jpeg

Jasmin_Sch
Helper IV
Helper IV

@_Nils_ Band the error occurred after I have created my collection

unfortunately I cannot reproduce this error as it just works for me.

_Nils__0-1618927101545.png_Nils__1-1618927163132.png_Nils__2-1618927190984.png_Nils__3-1618927215068.png

So I can only suggest the classic close and restart Powerapps or maybe try renaming the collection and see if it was just some internal thing.

Otherwise I don't really have any ideas

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,000)