replace a record in a file
Moderator: Rathinagiri
- tomtagaris
- Posts: 113
- Joined: Tue Aug 23, 2016 2:43 pm
replace a record in a file
can someone tell me why suddenly i can not replace a record in an file , like this ,not work - replace mark with markreplace-
Re: replace a record in a file
put some code - is it exclusibe mode or share mode? what's the error?
Re: replace a record in a file
I think this is what your asking.
I found at times if I use a msgbox or msginfo while on a record right after I have to use command with table name in it.
replace table->mark with marketplace.
If mark is a variable you can not use replace. Use equals.
mark := table->marketplace or mark := marketplace.
I found at times if I use a msgbox or msginfo while on a record right after I have to use command with table name in it.
replace table->mark with marketplace.
If mark is a variable you can not use replace. Use equals.
mark := table->marketplace or mark := marketplace.
All The Best,
Franco
Canada
Franco
Canada
Re: replace a record in a file
You can use such a statement
Code: Select all
Table->(rlock())
Table->marketplace := market
Table->(dbrunlock())
- tomtagaris
- Posts: 113
- Joined: Tue Aug 23, 2016 2:43 pm
Re: replace a record in a file
the problem is at the end of the file after BEGIN SEQUENCE WITH {|o| break(o)} , I place it at the beginning of the work
the append blank working don working the Replace
For i=1 TO Len( hResponse )
Select 2
seek hResponse["invoiceMark"]
if found()
msgbox('Υπάρχει ο Mark')
replace MarkReques with hResponse["invoiceMark"]
skip
else
msgbox('Δέν υπάρχει o Mark',hResponse["invoiceMark"] )
append blank
2-> MARKREQUES := hResponse["invoiceMark"]
replace u_id with hResponse["invoiceUid"]
COMMIT
EndIf
Next i
the append blank working don working the Replace
For i=1 TO Len( hResponse )
Select 2
seek hResponse["invoiceMark"]
if found()
msgbox('Υπάρχει ο Mark')
replace MarkReques with hResponse["invoiceMark"]
skip
else
msgbox('Δέν υπάρχει o Mark',hResponse["invoiceMark"] )
append blank
2-> MARKREQUES := hResponse["invoiceMark"]
replace u_id with hResponse["invoiceUid"]
COMMIT
EndIf
Next i
Re: replace a record in a file
Try to comment Begin sequence - you will see immediately what is the source of error.
Did you set EXCLUSIVE to .T.?
You don't use record locking in this code
Did you set EXCLUSIVE to .T.?
You don't use record locking in this code
Re: replace a record in a file
IF 2 IS USED SHARED I WOULD
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
IF RLOCK()
replace MarkReques with hResponse["invoiceMark"]
UNLOCK
ENDIF
skip
else
msgbox('Δέν υπάρχει o Mark',hResponse["invoiceMark"] )
SELECT 2
append blank //FRANCO APPEND BLANK LOCKS RECORD
**** 2-> MARKREQUES := hResponse["invoiceMark"]
REPLACE MARKREQUES WITH hResponse["invoiceMark"]
replace u_id with hResponse["invoiceUid"]
UNLOCK
COMMIT
EndIf
SELECT hResponce
Next i
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
IF RLOCK()
replace MarkReques with hResponse["invoiceMark"]
UNLOCK
ENDIF
skip
else
msgbox('Δέν υπάρχει o Mark',hResponse["invoiceMark"] )
SELECT 2
append blank //FRANCO APPEND BLANK LOCKS RECORD
**** 2-> MARKREQUES := hResponse["invoiceMark"]
REPLACE MARKREQUES WITH hResponse["invoiceMark"]
replace u_id with hResponse["invoiceUid"]
UNLOCK
COMMIT
EndIf
SELECT hResponce
Next i
Last edited by franco on Wed Aug 19, 2020 5:24 pm, edited 2 times in total.
All The Best,
Franco
Canada
Franco
Canada
- tomtagaris
- Posts: 113
- Joined: Tue Aug 23, 2016 2:43 pm
Re: replace a record in a file
the problem is for - next
Without for - next the record replaces
I do not understand
Without for - next the record replaces
I do not understand
Re: replace a record in a file
Look at above sample
I added select the first file before the next
I think I would use a do while loop instead of for next
SELECT FILE1
GO TOP
DO WHILE ! EOF()
SELECT FILE1
HRESPONCE
SELECT FILE2
AND SO ON
SELECT FILE1
SKIP
LOOP
ENDDO
I added select the first file before the next
I think I would use a do while loop instead of for next
SELECT FILE1
GO TOP
DO WHILE ! EOF()
SELECT FILE1
HRESPONCE
SELECT FILE2
AND SO ON
SELECT FILE1
SKIP
LOOP
ENDDO
Last edited by franco on Wed Aug 19, 2020 5:16 pm, edited 1 time in total.
All The Best,
Franco
Canada
Franco
Canada
- tomtagaris
- Posts: 113
- Joined: Tue Aug 23, 2016 2:43 pm
Re: replace a record in a file
It did not work
The problem is in the for next
If I put it for 1 to 2 then it is ok
Select 2
For i=1 TO 2
Replace MARKREQUES with 'samone'
replace u_id with kalavrita'
COMMIT
Next i
The problem is in the for next
If I put it for 1 to 2 then it is ok
Select 2
For i=1 TO 2
Replace MARKREQUES with 'samone'
replace u_id with kalavrita'
COMMIT
Next i