Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 8 Jahren, 8 Monaten
Letzter Beitrag:
vor 8 Jahren, 8 Monaten
Beteiligte Autoren:
Michael, Piet van Zanten, Art Bonds, Jimbo

Passing parameters to a PROCEDURE - Automatic conversion

Startbeitrag von Michael am 19.10.2009 02:29

Hi All:
I have a procedure with a parameter defined as string. If I pass a string as '2343.343434.2323.3434' the parameter is converted to numeric and only 2343.343434 is considered. If I include any letter or symbol (not only numbers) it seems like it takes my string as it's.
Why is making such conversion? I need to pass strings which only contains numbers and dots...But there are still strings, not numbers...

Any idea how can I avoid the conversion?
Thanks

Michael

Antworten:

Hi Michael,

isn't there the standard way of declaring parameters for procedures like below?

PROCEDURE MyProcedure(sABC as string, iDEF as 4-byte int, bGHI as boolean)

Kind regards,
Guenter



von Jimbo - am 19.10.2009 03:17
Hello Guenter:

Yes, I have defined in that way. But even so, if I pass a string like '234.233.2333' (without any letter or other symbol than a dot...), it 's considered as a number so it's converted to 234.233 , so the last part after the second dot is lost.

You can also define a procedure without specifyng the types of the parameters, but in this cause I would justify the conversion. But in my case, where I 'm explicitly defining a parameter as a string, I would not expect to have it converted as a number.

The workaround is to append some letter to the parameter and then take this out in the Procedure...

Thanks;
Michael

von Michael - am 19.10.2009 16:37
Which product and version are we talkin about?

von Piet van Zanten - am 19.10.2009 16:55
I 'm using WinDev12.

Regards;
Michael


von Michael - am 19.10.2009 20:47
Hi Michael,

I cannot replicate this problem.

New_Procedure("2343.343434.2323.3434")
x is string="2343.343434.2323.3434"
New_Procedure(x)

PROCEDURE New_Procedure(sText is string)
Trace(sText)

Both methods return the string as expected. Even if I dont declare the parameter it works fine.

Regards,
Piet

von Piet van Zanten - am 19.10.2009 21:07
Hello Piet:

Actually, the procedure is a Global Procedure exposed as a web service. May be, this is the difference why is not working for me.

Thanks;
Michael

von Michael - am 23.10.2009 04:53
JAT... using single or double quotes?

von Art Bonds - am 23.10.2009 14:46
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.