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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable as parameter in cursorsetprop

Status
Not open for further replies.

jerold

Programmer
Aug 30, 2000
52
PH
when i use cursorsetprop("buffering",3,&mytable),
there is an error

mytable is a variable for table name.

i need to use a variable in table name
because in my form, it will use a table
depending on the input.

how do i go about this problem.
pls hel me

thanks
 
jerold

You will see a variable used in the following code - your macro substitution is incorrect

FOR lnTableNo = 1 TO 32767
[tab]IF !EMPTY(SELECT(lnTableNo)) && Checks for open tables
[tab][tab]SELE (lnTableNo)
[tab][tab]* REINDEX && Not for shared
[tab][tab]lcCurrentAlias = ALIAS()
[tab][tab]CURSORSETPROP([Buffering],3,(lcCurrentAlias))
[tab]ELSE
[tab][tab]EXIT
[tab]ENDIF
ENDFOR

Chris :)
 
The function may be expecting a string. Try putting the macro in quotes.

cursorsetprop("buffering",3,"&mytable")

-Pete
 
thanks for the help.

I have another problem.

How will i use the variable mytable when i want to access its fields (e.g idno)?

please help men

 
jerold

One way would be:-

TEMPALIAS = ALIAS()

SELE (TEMPALIAS)
lcField = TEMPALIAS + [.city]
REPL (lcField) with [New York]
? EVAL(lcField)

Chris :)
 
Doesn't Jerold just want:
Code:
&myTable..fieldname
to reference his fields?


and for his original query:
Code:
cursorsetprop("buffering",3,mytable)
ie omit the ampersand
 
Chris

&myTable..fieldname works but uses macro substitution, an unpleasant habit of which I am trying to purge myself. :)

cursorsetprop("buffering",3,mytable) is fine but the reason for including the brackets in the example is that to select the table SELE mytable without the brackets will fail.

Chris
 
*mytable is a variable (e.g. mytable = "temp")

*open table method of data environment has this code
sele 1
use table2

sele 2
use &mytable

how will i set a relation on the field1 of mytable
into field1 of table2?

Help me again.thanks
 
Dario

Not really qualified to answer your question as never use the Data EnvironMent, preferring to make and break relationships in MAIN.prg or form methods, but try the following:-

SELE (mytable) && Child table
SET ORDER TO customerid

SELE table2 && Parent table
SET ORDER TO customerid
SET RELA TO customerid INTO (mytable)

As you can see, you will need brackets around mytable to identify it a variable

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top