"Transform" function

This forum is meant for questions and discussions about the X# language and tools
Post Reply
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

"Transform" function

Post 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
Best regards,
Leonid
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

"Transform" function

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

"Transform" function

Post by leon-ts »

Hi Chris,
Thanks for the answer!

Best regards,
Leonid
Best regards,
Leonid
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

"Transform" function

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

"Transform" function

Post by leon-ts »

Robert,
Thanks for clarifying!

Best regards,
Leonid
Best regards,
Leonid
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

"Transform" function

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
kevclark64
Posts: 127
Joined: Thu Aug 15, 2019 7:30 pm
Location: USA

"Transform" function

Post 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.
Post Reply