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!

How to append cursors ?

Status
Not open for further replies.

Coolprogram

Programmer
Nov 9, 2011
15
LT
Well i need to append data from cursor 1 to cursor 2 . As i make a system for a storage accounting system , we will use bar codes and barcode scanner
 
i'm trying to do like this
CREATE CURSOR rasti(bar_kodas char(20) NOT NULL,pavadinimas varchar(100) DEFAULT NULL,vieta_sandelyje varchar(20) DEFAULT NULL,kiekis float DEFAULT NULL,kaina float DEFAULT NULL)
a = UPPER(ALLTRIM(thisform.text1.Value))
rezultatai =SQLEXEC(P1,"SELECT * FROM zaliavosprekes WHERE bar_kodas = ?a ","afas")
SELECT rasti
APPEND FROM Cursor("afas")
 
Hi,

Alterantively to Mike's correct answer you could also consider to write:

Code:
Select bar_kodas, pavadinimas, vieta_sandelyje, kiekis, kaina From afas Into Cursor rasti

and forget about your create cursor line.

Regards,

Jockey(2)
 
Well i'm scanning bar codes , cursor afas gets values of product and appends it to cursor rasti . How come i'm getting only one value in cursor rasti ? I thought it will append values from cursor afas to rasti to make a list of products
 
I found the problem , I was creating cursor every time i klick a button
 
becareful when using cursor and your not running private data sessions.

if the user opens the forms twice, each instance of the form will create the same cursor name and you will have chaos and conflicts.

this is what i do to handle cursors in non-private data session forms:

I add a property to the form call it: curScan

in the init of the form:
thisform.curScan = sys(2015)

in the buttom that creates the cursor:
Code:
if empty(thisform.curScan)
   thisform.curScan = sys(2015)
endif 
curScan = thisform.curScan

create cursor (curScan) (barcode1 c(20), etc..)

in the unload of the form
Code:
  curScan = thisform.curScan
  if not empty(curScan)
     use in sele(curScan)
  endif


now, anywhere in the form, you can use the cursor and without conflicting with another instance of the form with the same cursor name.

hope that helps.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
furthermore,

to use the cursor in the form:
Code:
curScan = thisform.curScan
&& assuming you already created the cursor etc..

select (curScan)
&& do whatever..

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top