Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR OF SYNTAX IN MENU !!!

Status
Not open for further replies.

midou

Programmer
Oct 20, 2002
24
FR
Hi!
I use this code to create a menu by programm, it display me "Syntax error",how can I correct it?
[Set filter to alltrim(profil)="AGENT"
Set order to xsitem
Go top
j=1,i=1,m=space(6)
Scan while !eof( )
If item =space (6)
Define PAD MAINTFORM_ITEMS OF _MSYSMENU PROMPT tree.nom
COLOR SCHEME 3;
On PAD MAINTFORM_ITEMS OF _MSYSMENU ACTIVATE POPUP tree.nom
N=tree.nom
Define POPUP N MARGIN RELATIVE COLOR SCHEME 4
m=tree.sitem
j=j+1
Endif
If tree.nom=m
h=alltrim(str(i))
Define BAR i OF j PROMPT tree.nom
Endif
i=i+1
Skip
Endscan]
Thanks for your attention and your help.
 
The line:
j=1,i=1,m=space(6)
is not legal. You need to put each assignment on a separate line.

Also, you don't need the GO TOP command. By default, SCAN without the NEXT parameter goes to the top of the table and runs through the entire table. You also don't need the WHILE !EOF() portion; SCAN knows to stop at the end of the table.
 
...And get rid of the SKIP command. Scan does this automatically too.

Dave S.
 
YOur statement SCAN WHILE !EOF() doesn't make any sense.

SCAN ENDSCAN automatically scans through your records untill the end of your cursor. (See MSDN)

The condition WHILE !EOF() can be removed and will probably speed up your process.

Anohter thing:

You first set a filter and than you start a scan.

You can put your filter condtion inside the SCAN ENDSCAN condition (remember that filters can be very slow).

e.g:

Set filter to alltrim(profil)="AGENT"
Set order to xsitem
Go top
j=1,i=1,m=space(6)
SCAN
*- rest of code
ENDSCAN

This could be:

SET ORDER TO xsitem
j=1
i=1
m=space(6)
SCAN FOR alltrim(profil)== "AGENT"
*- rest of code
ENDSCAN

*- it is also good practice to give variables meaningfull names (iso i, j, m ), this provides other programmers (and your future self !!) with readible code.

HTH,
Weedz (Wietze Veld)
My private project:Download the CrownBase source code !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top