Page 1 of 1

Expression. Text field

Posted: 14 Sep 2020, 14:40
by gazmoz17
Hi,

Audit split.Details Occasionally this field will have tonnage figures in e.g. 22,000Kg

Is it possible to treat this as a number.

Wish to form an expression:

Auditsplit.Net/Auditsplit.Details

I dont know if can do this with text fields and also with the added complication of the"Kg" at the end which I would like to keep in if possible.

Thanks
Gareth

Re: Expression. Text field

Posted: 14 Sep 2020, 15:20
by brucedenney
Yes, you can.

you need to start by removing the KG.

then you can convert the string to a number.

these are the functions you need.

Code: Select all

Replace("The String to alter.", "A String to be replaced.", "A String to replace all occurrences of the specified String.")

Code: Select all

StringToFloat("A string containing a number to convert.")

Re: Expression. Text field

Posted: 14 Sep 2020, 15:43
by gazmoz17
Cheers Bruce will have a look tomorrow.

Re: Expression. Text field

Posted: 14 Sep 2020, 15:55
by gazmoz17
Hi Bruce,

Works great thanks. Can I encompass variations of Kg, kg, KG etc within replace?

Thanks

Re: Expression. Text field

Posted: 14 Sep 2020, 16:31
by brucedenney
You could do multiple separate expressions or force it all uppercase first.

Re: Expression. Text field

Posted: 15 Sep 2020, 08:40
by gazmoz17
Thanks Bruce...

Ive tried to add on the data joiner The project reference fields & cost code field to the below report. So when I import the below fields I can run this report & see all the fields.

Really struggling with the join tried a few variations but think the sage help material is cr*p!
Import snippet.JPG
Purch inv cntrl proj & cost code refs.report
Thanks
Gareth

Re: Expression. Text field

Posted: 15 Sep 2020, 14:23
by brucedenney
The issue lies in the expression that is generating the price.

The expression called "Details" does not always have something that can convert to a number so it fails.

I am not sure how you can get around this.

I would do this sort of thing in Excel and link the data in with ODBC.

Re: Expression. Text field

Posted: 15 Sep 2020, 15:57
by gazmoz17
Hi Bruce,

Yeah stumbled across this might be why then. So if ive got "Materials" in Details its trying to make this a number.

Ok might get rid of that kg price end field.

Thanks

Re: Expression. Text field

Posted: 15 Sep 2020, 18:33
by brucedenney
You could put is somewhere else?