PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → HAdd not building correct composit key
HAdd not building correct composit key
Iniciado por sbelt, 16,ene. 2004 10:41 - 1 respuesta
Publicado el 16,enero 2004 - 10:41
I know this is simple but I just don't see what I'm doing wrong
I have a Hyper file with a composit key of "company code + a voucher number + a sequence number". When I use "HAdd" my composit key ends up as "company code + a voucher number" - no sequence number. My analysis looks right - I've regened the RAD - no matter what, the composit key is not correct.
Any help for a blind man?
I'm using a two column table, entering 2-3 lines then going back and changing
line 1. The HReadSeek always fails because the HAdd is not getting the sequence
number.
Here is the code:
============================================================
Seq is string = CurrentSubscript() + 69
key is string = CoCode + gVoucher + Seq
CM1_empitem is string
CM1_Amount is int = 0
HReadSeek(CM1,cm1_CCcm1_Vouchercm1_Seq1,key,hLockWrite)
IF HFound() THEN
//extract record
wn_commission_entry.Table3.Amount[2] = wn_commission_entry.Table3.Amount[2] - CM1_Amount + Table1.Amount
HWrite(CM1,H.NumRec)
ELSE
wn_commission_entry.Table3.Amount[2] = wn_commission_entry.Table3.Amount[2] + Table1.Amount
CM1.cm1_CC = CoCode
CM1.cm1_Voucher = gVoucher
CM1.cm1_Seq = Seq
CM1.cm1_Amount = wn_commission_entry.Table1.Amount
HAdd(CM1)
END
============================================================================
As always, your help is very appreciated!
shawn

http://dpcsystems.com
Publicado el 16,enero 2004 - 18:59
Try this to see if it works:

key is string = HBuildKeyValue(CM1,cm1_CCcm1_Vouchercm1_Seq1,CoCode,gVoucher,Seq)

Regs,
King

Shawn Belt <sbelt@dpcsystems.com> wrote:

I know this is simple but I just don't see what I'm doing wrong
I have a Hyper file with a composit key of "company code + a voucher number

+ a sequence
>number". When I use "HAdd" my composit key ends up as "company code + a
voucher number"
- no sequence number. My analysis looks right - I've regened the RAD - no

matter what,
the composit key is not correct.
Any help for a blind man?
I'm using a two column table, entering 2-3 lines then going back and changing
line 1. The HReadSeek always fails because the HAdd is not getting the sequence
number.
Here is the code:
============================================================
Seq is string = CurrentSubscript() + 69
key is string = CoCode + gVoucher + Seq
CM1_empitem is string
CM1_Amount is int = 0
HReadSeek(CM1,cm1_CCcm1_Vouchercm1_Seq1,key,hLockWrite)
IF HFound() THEN
//extract record
wn_commission_entry.Table3.Amount[2] = wn_commission_entry.Table3.Amount[2]

- CM1_Amount
+ Table1.Amount
HWrite(CM1,H.NumRec)
ELSE
wn_commission_entry.Table3.Amount[2] = wn_commission_entry.Table3.Amount[2]

+ Table1.Amount
CM1.cm1_CC = CoCode
CM1.cm1_Voucher = gVoucher
CM1.cm1_Seq = Seq
CM1.cm1_Amount = wn_commission_entry.Table1.Amount
HAdd(CM1)
END
============================================================================
As always, your help is very appreciated!
shawn

http://dpcsystems.com