Simplicty and flexibility!


Function::String

ToText
ToText(Value)
ToText(Date)
ToText(Number)
Retval:=ToText(MyDateField) .


To make sure a non-text field is returned as text in a script/derivation.

Parameters


ValueToConverT: Text

Input for this function is Text, which might seem strange but it is due to the fact that Text encompass all the field types in DataEase. This functio is to be used to convert other field types to text and in DataEase a text field will accept all field types as input.

Returns/Result


Text(255): Value input converted to string.

Examples


Reference

A lot of our seasoned developers know that what you see is not always what you get.

Internally DataEase converts values freely between formats, but not always. Especially when you use functions and allocated fields directly you might get peculiar results. Add CDF to the mix and you WILL get peculiar results.

Anyone that has dipped deep into stuff like Oracle has met the peculiar Null vs 0 problem. It is highly scientific, but then a lot of these databases was originally designed for scientific use. Haven't you wonder why half the functions in DataEase (up to 8) was Trigonometric functions like tan, atan and even atan2, or what about cos and cosh(hyperbolic cosine). If bet that if you know what cosine is you have no clue what an hyperbolic cosine is...

It is kind of a paradox that a product like DataEase that didn't have CHR() until 8, would have something like that, but that is down to hits historic roots. I am pretty sure that you today could easily launch a major application framework without cosh or even cos and easily get away with it, but not back in 1981.

Anyway, the NVL vs 0 problem is that in Oracle the number 0 and the definition NULL is not the same. 0 is a number in the middle between -1 and 1, when NULL defines Nothing.

You are now thinking...what the heck is he talking about. When I have 0 in my account I have nothing, but that is wrong. When you have 0 in your account you are in fact quite rich in comparison to someone that owns the bank 10.000 or even own them 1.

OK, OK!. You get my point. In practical terms, this is bullshit. But the problem in Oracle is that a number column when not initiated is actually NULL i.e. empty space and not 0. Hence in Oracle you always have to check a number column with NVL(column) which is simply a function that turns NULL into 0.

See this is why Blogs are such a brilliant forum for the blogger, but maybe not so much for the Bloggee..YOU...he,he. I have now been able to ramble on about something that I find interesting and hilarious, and that doesn't interest you at all, so I will get to the point.

ToText() is simply a function that insures that you transfer a string to another function. Most things in DataEase is transferred as strings so if you do that if you get weird results you will be fine.

The seasoned dogs will already know this and use jointext(field,"") which will work fine...in fact that is all ToText() do... but isn't it more elegant if you have to do it a lot to have a function do it for you?

It is 2012 after all...

Format: ToText(Field) returns Text

See Also


On the forum about ToText

On the blog about ToText

New Function in 8 - ToText() - Converts any DataEase field/function value to Text (Ver 8.0.0.1171)

A lot of our seasoned developers know that what you see is not always what you get. Internally DataEase converts values freely between formats, but not always. Especially when you use functions and allocated fields directly you might get peculiar resul...

Product: Dataease [{8}]FIVE. Written by DataEase 30/11/12 at 07:32:37

Re:New Function in 8 - ToText() - Converts any DataEase field/function value to Text (Ver 8.0.0.1171)

Can I have serial # for Dataease 8 Trial Ver. please...

Product: Dataease [{8}]FIVE. Written by Wahid DeWan 13/12/12 at 23:36:59

Re:Re:New Function in 8 - ToText() - Converts any DataEase field/function value to Text (Ver 8.0.0.1171)

Sorry, there is no trial serial for DataEase 8 at the moment....

Product: Dataease [{8}]FIVE. Written by DataEase 16/12/12 at 19:41:35


dg3_HelpView