Format without negative

use the following expression

[=TN(TN(‘{CALCULATION TOTAL}’)*1000)]

and I get a number preceded by a minus sign as -600

I wish I took away the minus sign and come out 600
How can I do?

Times by -1 to inverse negative and positive.

2 Likes

I do not understand what you mean, can you explain with an example. thanks

If you have a negative number and multiply it by -1 it is the positive of that number.
-600 x -1 = 600
600 x -1 = -600
It reverses positive and negative.

Formulas in samba is not my forte but I would hazzard a guess

[=TN(TN('{CALCULATION TOTAL}')*1000*-1)]

Or something along those lines - might need to add some brackets possibly but try that first.

Why formatting it TO Number twice?

I went of his formula, as I said not my forte.
You saying it should be;

[=TN(('{CALCULATION TOTAL}')*1000*-1)]
1 Like

This should work

[=TN('{CALCULATION TOTAL:Discount}')*1000*-1]

Change Discount to the actual calculation name.

1 Like

Sorry @kendash but for my own clarification could you confirm;

TN(’{CALCULATION TOTAL:Discount}’) : TN turning the called value in to numbers.

What to the ’ ’ marks do?

TN is not just turning it into numbers its specific for String Formatted number to a numeric number.

I see people using it a lot when they really didnt need too although it doesnt cause any harm.

Look here for better explanation.

1 Like

Thanks, I has read this post when originally customizing ticket template but was unsure of the term;

I take it to mean string number is a plain number with no formatting?!? Is that correct, TN being a way of formatting a number?

Read that it explains it well.

1 Like

If you ever want to test it… just use a show message and insert the tag you want to test the output of… no formatting just the tag… if it produces something like 1,323 then you need to use TN to convert it to 1323 when used in expression.

Thanks, sorry for my ignorance on the subject.
Just one last thing so I know I understand correctly; string and numerical, which way round is that? String if the formatted value the tag calls for and TN makes it plain numerical value?

I did some tests but I could not, are impractical, you can give an example …

Example {TICKET NO} would never need TN because it only produces numeric output… but {TICKET TOTAL} always produces #.## format so you would need TN if used in expression.

You cant wrap it with TN and it print the numeric format… the conversion is internal its so it can evaluate the expression it will still print it formatted. You can change that format with F or FF

@spanky I hope I didnt confuse you with this… in your case TN is needed. I was just pointing out some additional info.

1 Like

@spanky Please show your template so I can understand what your trying to do.

Kendash formula would show you the discount calculation total with the positive/negative inverted.

Depends on where he is using {CALCULATION TOTAL} my example was in a printer template outside of formatting… but if hes using it in [SERVICES] or somewhere else then {CALCULATION TOTAL} would work.

In his case [=TN('{CALCULATION TOTAL}')*1000*-1] should work.

… also @spanky you can simply multiply value with -1000.

2 Likes

LOL I always seem to look for the more complicated first. You are right haha.