PDA

View Full Version : iif function



Quailco
2014-01-10, 17:17
well one day soon I hope to complete a day of testing without having to bother you all. :/

so i am running thru a set of properties in the init of a class that creates my menu form. the form is properly created and modified in vfp. this case is to resize and move objects which may or maynot be needed in the end but the example repeats in many other places doing different things so i need to figure it out.

I simplified the first error occurance and it works so the problem wouuld seem to be with the iif Ive read all the docs I can find and no clue.

line creating the error

thisform.controls(X1).LEFT=IIF(THISFORM.CONTROLS(X 1).TAG=' ',thisform.controls(X1).LEFT*M.SCRSZ,thisform.cont rols(X1).LEFT)

error:

Fri Jan 10 13:47:29 2014
**** Lianja error ****
thisform.controls(X1).LEFT=IIF(THISFORM.CONTROLS(X 1).TAG=' ',thisform.controls(X1).LEFT*M.SCRSZ,thisform.cont rols(X1).LEFT)
^
Comma was expected
Called from program - mnu1.init() at line 84
Called from program - menu.dbo at line 49
Called from program - start.dbo at line 215

TIA

Jim

yvonne.milne
2014-01-13, 07:13
Hi Jim,

Not quite sure why this is getting an error (you can Submit a ticket (http://www.lianja.com/support/newticket) for further investigation), but if you create a reference for the control, the error is not occurring, e.g.


...
oCurrctrl = thisform.controls(X1)
oCurrctrl.LEFT=IIF(empty(oCurrctrl.TAG),oCurrctrl. LEFT*M.SCRSZ,oCurrctrl.LEFT)
...

Regards,

Yvonne

Quailco
2014-01-13, 14:45
Thanks Yvonne

I will make a note to look at submitting a ticket but for the moment using an object reference is a great work around.

Jim

Ps thought i posted this response but maybe i was in a hurry an muffed it.