cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Calculating with a value operator

Hello!

Currently I am calculating something using this formulas:

 

Set(
    sumTijdTotaal,
    Sum(
        colUrenRegistratie,
        TijdTotaal
    )
);
Set(
    remainder,
    8 - Mod(
        sumTijdTotaal,
        8
    )
);

 


And also this formula: 

 

        Patch(
            UrenRegistratie,
            Defaults(UrenRegistratie),
            EditForm1.Updates,
            {TijdTotaal: Value(EditForm1.Updates.TijdTotaal) - remainder}
        );

 


The first formula basically sums up all of the hours on the Tijdtotaal column in my database. This is a number value. The second one uses the mod function by 8 and gets the remainder of it. So if you have the value 9, the remainder will be 1. 

In the second formula, I just use the patch function to send information to my database. I do Tijdtotaal - the remainder and put that in the tijdtotaal column.

For some reasons this formula works good when only using full numbers. But as soon as I get a number with a comma, it removed the comma and sends it to the database.

So if I have a 6,25 it will write it as 625

What can I do about this?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Fixed it by putting some values to single line text instead of number

View solution in original post

6 REPLIES 6
troytec
Helper I
Helper I

When I troubleshoot things like that I use a label as the final value I am going to patch to my database. Use a label and set its text to your Tijdtotaal.

 

To me it sounds like the final outcome isn't coming out as a value but as text perhaps. Maybe try patching this:

TijdTotaal: Value(EditForm1.Updates.TijdTotaal - remainder)

 

Always worth giving it a go. 

Anonymous
Not applicable

Thank you for your answer @troytec !

The formula you provided me does not change anything sadly.

Create a variable that stores your calculation: totaal - remainder ?

Then place a label on the screen and set its text property to your calculation. Don't patch anything just yet. We need to see the final outcome.

Anonymous
Not applicable

I tried to do that, here is the outcome @troytec 

https://gyazo.com/85a003aa936f185652acbdae0eb82a13

You can see both values are stated as "Number" but the end result gives "" which is equal to nothing. 

Hmm, I have never used EditForm1.Updates to get data values. 

 

Try doing this:

 

//Set your tijdtotaal

 

 

Set(
    sumTijdTotaal,
    Sum(
        colUrenRegistratie,
        TijdTotaal
    )
);

 

 

//Set your remainder

 

Set(
    remainder,
    8 - Mod(
        sumTijdTotaal,
        8
    )
);

 

 

//Set a new variable for your calculation

Set(varTijdTotaal, 'Insert your calculation here');

 

Then your patch becomes:

       Patch(
            UrenRegistratie,
            Defaults(UrenRegistratie),
            EditForm1.Updates,
            {TijdTotaal: varTijdTotaal}
        );
Anonymous
Not applicable

Fixed it by putting some values to single line text instead of number

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,581)