PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD8] Data source as an optional parameter
[WD8] Data source as an optional parameter
Débuté par Tonni, 12 oct. 2005 11:03 - 8 réponses
Posté le 12 octobre 2005 - 11:03
I want to pass a data source as an optional parameter to another procedure. Optional parameters must have a default value. What's a logical default value for a data source?
Example:
procedure main()
dsQuery is data source
writeToFile(dsQuery)
end
procedure writeToFile(dsQuery is data source = ????)
//code
end
Posté le 12 octobre 2005 - 12:35
Hi Tonni,
haven't my WD PC at my side, but I would try to use NULL.
Regards
Raimund
I want to pass a data source as an optional parameter to another procedure. Optional parameters must have a default value. What's a logical default value for a data source?
Example:
procedure main()
dsQuery is data source
writeToFile(dsQuery)
end
procedure writeToFile(dsQuery is data source = ????)
//code
end



http://www.invitec.com
Posté le 12 octobre 2005 - 15:43
Thanks for the answer. Currently using the NULL value. Hopefully everyting will go right when I run the project later on. :-)
Hi Tonni,
haven't my WD PC at my side, but I would try to use NULL.
Regards
Raimund
Posté le 12 octobre 2005 - 16:22
Thanks for your help Raimund, but I'm still having some more problems with passing a data source as a parameter. For some reason WinDEV 8 sees the parameter as a string.
Example.
PROCEDURE main()
dsQuery is Data source
// initialize dsQuery
writeToFile((dsQuery))
END
PROCEDURE writeToFile(pdsQuery is Data source)
END
As soon as the call to writeToFile is done, the data source is converted to a string and the contents of that string is the variable name of the initial Data source. So in this case pdsQuery would be a string with contents "dsQuery".
Am I overseeing something here?
Hi Tonni,
haven't my WD PC at my side, but I would try to use NULL.
Regards
Raimund
Posté le 12 octobre 2005 - 18:45
Hi Tonni,
If everything fails, maybe you can use a global declaration for the data source?
Regards,
Piet
Posté le 12 octobre 2005 - 21:48
Hello Tonni,
your problem is the (()) call. That's not possible for a data source.
Try the code below:
ds1 is Data Source
ds1.Test = 1
MyProc(ds1)
PROCEDURE MyProc(ds is Data Source)
Info(ds.Test)
Raimund
Thanks for your help Raimund, but I'm still having some more problems with passing a data source as a parameter. For some reason WinDEV 8 sees the parameter as a string.
Example.
PROCEDURE main()
dsQuery is Data source
// initialize dsQuery
writeToFile((dsQuery))
END
PROCEDURE writeToFile(pdsQuery is Data source)
END
As soon as the call to writeToFile is done, the data source is converted to a string and the contents of that string is the variable name of the initial Data source. So in this case pdsQuery would be a string with contents "dsQuery".
Am I overseeing something here?
Hi Tonni,
haven't my WD PC at my side, but I would try to use NULL.
Regards
Raimund



http://www.invitec.com
Posté le 13 octobre 2005 - 11:26
Hi Raimund,
Thanks again for your help, but I tried that too. It doesn't work either.
Regards,
Tonni
Hello Tonni,
your problem is the (()) call. That's not possible for a data source.
Try the code below:
ds1 is Data Source
ds1.Test = 1
MyProc(ds1)
PROCEDURE MyProc(ds is Data Source)
Info(ds.Test)
Raimund
Posté le 13 octobre 2005 - 11:33
Hi Piet,
Thanks for your help. A global declaration for the data source will probably work but as long as it isn't really necessary I'd rather use another solution. The program is too big to add another global variable just for a little piece of the program.
Thanks for the tip though.
Regards,
Tonni

Hi Tonni,
If everything fails, maybe you can use a global declaration for the data source?
Regards,
Piet
Posté le 13 octobre 2005 - 15:37
Hello Tonni,
I did test this with WD8 and WD9. Works with both.
Raimund
Hi Raimund,
Thanks again for your help, but I tried that too. It doesn't work either.
Regards,
Tonni
Hello Tonni,
your problem is the (()) call. That's not possible for a data source.
Try the code below:
ds1 is Data Source
ds1.Test = 1
MyProc(ds1)
PROCEDURE MyProc(ds is Data Source)
Info(ds.Test)
Raimund



http://www.invitec.com