cancel
Showing results for
Did you mean:
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),
);``````

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

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

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

6 REPLIES 6
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

The formula you provided me does not change anything sadly.

Helper I

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.

Helper I

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

Try doing this:

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

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

//Set a new variable for your calculation

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

``````       Patch(
UrenRegistratie,
Defaults(UrenRegistratie),
{TijdTotaal: varTijdTotaal}
);``````
Anonymous
Not applicable

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

Announcements