Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Declaration of variables used as parameter


MortenS Oct 21, 2011 11:36 AM

Hi there

In this little program I declare a varible (ErrotType) as a local to the sub, but my data transfered to the sub when I call it, is not reaching my "s" varible....


Did I misunderstud something or ????
My intention is to pass "STS" to "s"


Public s = String * 5

Sub NewSub(ErrorType As String * 5)
s=ErrorType
EndSub

'Main Program
BeginProg
Scan (1,Sec,1,0)
Call NewSub("STS")
NextScan
EndProg


MortenS Oct 21, 2011 11:49 AM

This is wrong: Public s = String * 5
Should be Public s as String * 5

That did fix the problem :-)

Thanx anyway


MortenS Oct 21, 2011 01:59 PM

The code listet above was just a simple example of what I was doing.

In my "big" program it dosn't work. I tried using FP2 as type for my paramter. That make it work.

So my question is: Are there differentes or "hidden" rules in what type you are parsing ?


artmann Oct 25, 2011 01:53 PM

Hi,

as far as i understand the datatype FP2 is only a type for the output of a datatable.

For "processing" only the types Float,Long, Boolean and String can be used.
Try to define your parameter "as Float"


MortenS Oct 25, 2011 02:25 PM

Hi Artmann

I thought that FP2 was default when not declaring a specific type. I was wrong. It is float that is default and therefor I tried what you mentioned allready :-)

Log in or register to post/reply in the forum.