For Programmers: Free Programming Magazines  


Home > Archive > Clarion > September 2005 > Set(Key,Key)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Set(Key,Key)
JJ

2005-09-01, 7:55 am

Hi,
I'm using Clarion 6.2 build 9047 and i have a problem with a bit of
code.

I've got a Simple loop processing some records. Before the loop I Use
the set command to setup the key and where its going to start looking
at the records

Sample code

Phi:number=emp:number
set(PHI:PAYNO,PHI:PAYNO)
next(phistory)
loop
Process records
Next(phistory)
If errorcode() then break.
end

Right this works the first Time you run the code.
But the second time it dosent point to the Same place It misses the
first record and starts at the next key value ! ie

phi:no phi:data
4001 data2
4001 data
4002 data
4002 data2


first time it points correcttly at 4001 data but the next time it
points at 4002 data.

Any ideas?

Leonid Chudakov

2005-09-01, 7:55 am

Hi,

Is PHI:PAYNO a multicomponent key?
Try

CLEAR(PHI:Record)
Phi:number=emp:number
set(PHI:PAYNO,PHI:PAYNO)
next(phistory)
loop
Process records
Next(phistory)
If errorcode() then break.
end


--
--
Leonid Chudakov
chudakov@klarisoft.com
Cool tools and Clarion examples at
http://www.klarisoft.com

"JJ" <jj@cwgsy.net> wrote in message
news:1125571254.016065.266380@o13g2000cwo.googlegroups.com...
> Hi,
> I'm using Clarion 6.2 build 9047 and i have a problem with a bit of
> code.
>
> I've got a Simple loop processing some records. Before the loop I Use
> the set command to setup the key and where its going to start looking
> at the records
>
> Sample code
>
> Phi:number=emp:number
> set(PHI:PAYNO,PHI:PAYNO)
> next(phistory)
> loop
> Process records
> Next(phistory)
> If errorcode() then break.
> end
>
> Right this works the first Time you run the code.
> But the second time it dosent point to the Same place It misses the
> first record and starts at the next key value ! ie
>
> phi:no phi:data
> 4001 data2
> 4001 data
> 4002 data
> 4002 data2
>
>
> first time it points correcttly at 4001 data but the next time it
> points at 4002 data.
>
> Any ideas?
>



JJ

2005-09-01, 7:55 am

Many thanks That appears to have Sorted It!

Marko Frelih

2005-09-05, 6:55 pm

but should't this code looke like this:

CLEAR(PHI:Record)
Phi:number=emp:number
set(PHI:PAYNO,PHI:PAYNO)
loop
Next(phistory)
If errorcode() then break.
Process records
end

Why is after SET statement NEXT statement?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com