I changed my sample above. I would suggest to use select TABLENAMES instead of 2.
Try do while loop.
If it does not work I will try to make sample. What is table 2`s name.
replace a record in a file
Moderator: Rathinagiri
Re: replace a record in a file
All The Best,
Franco
Canada
Franco
Canada
-
- Posts: 245
- Joined: Sat Aug 02, 2008 5:03 pm
Re: replace a record in a file
Hi,
I think you have to check the len( hResponse ) and each item of the hash hResponse before the for next
I think you have to check the len( hResponse ) and each item of the hash hResponse before the for next
Regards/Saludos, Carlos (bcd12a)
Re: replace a record in a file
I think Carlos is right and skip is in the wrong spot
maybe
local mrec
select hResponse
Mrec := reccount()
go top
for i := 1 to mrec
if
code
endif
select hResponse
skip
next i
maybe
local mrec
select hResponse
Mrec := reccount()
go top
for i := 1 to mrec
if
code
endif
select hResponse
skip
next i
All The Best,
Franco
Canada
Franco
Canada
Re: replace a record in a file
Maybe problem lays in len(hResponse) statement?
Try to replace with len(hb_hKeys(hResponse))
By the way, for what are you searching the same record in the loop:
seek hResponse["invoiceMark"]
if found()
Try to replace with len(hb_hKeys(hResponse))
By the way, for what are you searching the same record in the loop:
seek hResponse["invoiceMark"]
if found()
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: replace a record in a file
Thank you very much
for your response and your valuable help
I solved the problem as follows
if Len( hResponse ) > 1
For i=1 TO Len( hResponse )
Select 2
seek hResponse["invoiceMark"]
if found()
msgbox('Υπάρχει ο Mark') //Franco I have trouble here so i RESELECT TABLE AFTER MSGBOX
SELECT 2
replace MarkReques with hResponse["invoiceMark"]
ENDIF
skip
else
msgbox('Δέν υπάρχει o Mark', hResponse["invoiceMark"] )
SELECT 2
REPLACE MARKREQUES WITH Val(hResponse["invoiceMark"])
replace u_id with hResponse["invoiceUid"]
COMMIT
EndIf
Next i
else
SELECT 2
// append blank //FRANCO APPEND BLANK LOCKS RECORD
**** 2-> MARKREQUES := hResponse["invoiceMark"]
REPLACE MARKREQUES WITH Val(hResponse[1]["invoiceMark"])
replace u_id with hResponse[1]["invoiceUid"]
Replace Success with hResponse[1]["statusCode"]
COMMIT
EndIf
for your response and your valuable help
I solved the problem as follows
if Len( hResponse ) > 1
For i=1 TO Len( hResponse )
Select 2
seek hResponse["invoiceMark"]
if found()
msgbox('Υπάρχει ο Mark') //Franco I have trouble here so i RESELECT TABLE AFTER MSGBOX
SELECT 2
replace MarkReques with hResponse["invoiceMark"]
ENDIF
skip
else
msgbox('Δέν υπάρχει o Mark', hResponse["invoiceMark"] )
SELECT 2
REPLACE MARKREQUES WITH Val(hResponse["invoiceMark"])
replace u_id with hResponse["invoiceUid"]
COMMIT
EndIf
Next i
else
SELECT 2
// append blank //FRANCO APPEND BLANK LOCKS RECORD
**** 2-> MARKREQUES := hResponse["invoiceMark"]
REPLACE MARKREQUES WITH Val(hResponse[1]["invoiceMark"])
replace u_id with hResponse[1]["invoiceUid"]
Replace Success with hResponse[1]["statusCode"]
COMMIT
EndIf
Re: replace a record in a file
I am glad you got it working.
For what you are doing I think i would use related tables. It would be a lot less code.
For what you are doing I think i would use related tables. It would be a lot less code.
All The Best,
Franco
Canada
Franco
Canada