Hello,
I have a TextInput field and I add a unit by this expression:
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h"
But I want to use this TextInput field in another field to calculate the sum. The sum should also have a "h" attached.
How can I do this?
Hi @chhe
As a quick summary, to use the text input control values in the calculation, the key step is to remove the "h".
@mdevaney uses the standard, and valid technique of calling the Left function to return all the characters in the text input control, minus 1.
Another method that you might find easier is to strip out the "h" by calling the substitute function. The snippet of code you would use looks like this:
Substitue('ArbeitszeitSprint.Auftrag'.Text; "h"; "")
The formula that you would use for your field 3 example would look like this.
Text(
Value(Substitue('ArbeitszeitSprint.Auftrag'.Text; "h"; ""))
+
Value(Substitue('ArbeitszeitSprint.Kosten'.Text; "h"; ""))
) & "h"
Perhaps you could give that a try and see how you get on.
I cant calculate with these fields.
Field 1:
result: 27,26h - everything fine
Value(
Left(
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
)
) & "h"
Field 2:
result: 10,26h - everything fine
Value(
Left(
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Kosten'.Text/100)) & "h";
Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Kosten'.Text/100)) & "h")-1
)
) & "h"
Field 3:
This field should calculate the sum from Field 1 and 2.
Text(
Value(
Left(
Text(Value('ArbeitszeitSprint.Auftrag'.Text)+Value('ArbeitszeitSprint.Kosten'.Text)) & "h";
Len(Text(Value('ArbeitszeitSprint.Auftrag'.Text)+Value('ArbeitszeitSprint.Kosten'.Text)) & "h")-1
)
)) & "h"
The result is: 0h
But the result should be 37,62h (27,36h + 10,26h)
I cant believe that it is so hard to add a user specific unity... Are there no other ways? 😄
Right, I was simply showing you how to add the numbers. You can add 'h' at the end the same way @timl showed you previously.
Text(
Value(
Left(
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
)
) + 100) & "h"
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Hello,
for a test I have deleted the +100.
But when I insert the code as follows, there is no "h" behind the value.
Value(
Left(
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h";
Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
)
)
Something like this will do the trick. Make sure to replace the + 100 with your own value.
Value(
Left(
Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h",
Len(Text(Value('Arbeitszeit.Gesamt'.Text)*Value('Vorgabe.Auftrag'.Text/100)) & "h")-1
)
) + 100
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."