xsharp.eu • "Transform" function
Page 1 of 1

"Transform" function

Posted: Fri Apr 07, 2023 7:51 am
by leon-ts
Hi all,
Found in the old VO code (written before me), which is now ported to X#, the use of the "Transform" function with the character "S" and length. In VO, it is used as a string limit to the specified length.
For example:

Code: Select all

Transform(<StringValue>, "@S8") // transform to 8 character string
But in the documentation for this function, I did not find any mention of either the "S" character or the length. I noticed this when I discovered an inconsistency in the behavior of this function in X# and VO when a length is specified.
For example:

Code: Select all

SLen(Transform(Space(100), "@S8"))
In VO this expression returns 8, and in X# it returns 100. It seems that X# does not take into account the length specified after the "S" character.

Is there any complete documentation on the "Transform" function?

Best regards,
Leonid

"Transform" function

Posted: Fri Apr 07, 2023 8:24 am
by Chris
Hi Leoind,

It's the VO documentation what we based the implementation of Transform() in X# on, so that missing part is why it's not working the same way as in VO with that command! Not that it's the first time that the VO docs are incomplete or even misleading, we have found so many cases in the last years while trying to make X# compatible to VO...

Thanks for the report, we'll adjust Transform() in X# so that it works as in VO with that command.

"Transform" function

Posted: Fri Apr 07, 2023 8:43 am
by leon-ts
Hi Chris,
Thanks for the answer!

Best regards,
Leonid

"Transform" function

Posted: Fri Apr 07, 2023 11:52 am
by robert
Guys,
I checked this with Xbase++, Harbour and FoxPro, and the S picture function is also supported in all of them and also not documented in any of these products.
This is probably the "best kept secret" in the Xbase world.
IIRC this was implemented as part of the @ SAY ... GET command, where the space on the screen for a GET had to be limited because the complete string did not fit on the screen.
So the get field would scroll when the length exceeded the given number.
The S is short for "Scroll" I think.

Robert

"Transform" function

Posted: Fri Apr 07, 2023 12:09 pm
by leon-ts
Robert,
Thanks for clarifying!

Best regards,
Leonid

"Transform" function

Posted: Sat Apr 08, 2023 6:29 am
by Chris
That was indeed interesting and also funny to read, had no idea! It's now fixed (S picture supported) for the next build.

"Transform" function

Posted: Mon Apr 10, 2023 8:45 pm
by kevclark64
I tried the "@S8" with Transform in FoxPro and it didn't seem to work. LEN(Transform(Space(100), "@S8")) returns 100 in FoxPro. It would be a handy feature though.