I have the next situation:
Browse 1 on file 1, other tables valuta
Report 1 on file2
Source 1 other tables valuta
Window 1 no tables
Borwse 1 and Window 1 both call Report 1. Inside Report 1 Source 1 is called.
Source 1 is
do OpenFiles
clear(valuta)
val:sifra=valIn
get(valuta,val:KeyVAL)
if not errorcode()
if val:aktivnost<>'A'
clear(valOut)
clear(valuta)
else
valOut=val:sifra
end
else
clear(valOut)
clear(valuta)
end
do CloseFiles
return valOut
It appears that when calling report 1 from browse 1 the valuta buffer is cleared after do Closefiles and when it is called from Window 1 this does not happen.
When I add valuta on Report 1 other tables list all is OK.
I think that:
1. The record buffer shouldn't be cleared after Access:valuta.Close
2.Even if 1 is debatable in the case when you open twice the same table (i.e. open(valuta), open(valuta), close(valuta)…)
the Browse 1 did has the valuta on list so I do not understand.
Thanks
Nenad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm; I suspect problem is that I may of implemented threading state on files incorrectly.
Whether or not a file is open is tracked on a per thread basis. But looking a Clarion 6 ABC, looks like ABC assumes tracking is global, without respect to threads.
Try this dirty hack and let me know if it improves things:
In ABFILE.INC look for Opened field in FileManager:
Opened UNSIGNED,PRIVATE
Add THREAD to it:
Opened UNSIGNED,PRIVATE,THREAD
If this works let me know, I'll look at making c2j model file state WRT threads to reflect how ABC assumes it should behave.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tracked down the problem.
The track is:
Filemanager.close
FileManager.noteClose
FileManager.restorefile
and then after this.file.restoreState(frm.saved.state.intValue());
the record buffer is cleared.
I do not understand :
1. Why I entered if (!this.useFile().boolValue()) since the browse procedure calling the report calling the source file has valuta table on list? Is it maybe that the indicator of file usage is reset with every procedure?
2.Why restoreState clears anyway the buffer? Shouldn't it be left as it is at the moment when close happens?
Thanks and you do not have to rush with problem solution since holidays are here. Happy holidays and if i can help with some additional information just tell.
Nenad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think this sounds like normal clarion behaviour when moving between procedures. On return to procedure, ABC calls WindowManager.Reset() which I think calls restore file to return file state. I regularly encounter and have to deal with this; both when compiling clarion .exe and with c2j.
restorefile is a ABC method, it by design does two things:
* calls functions RESTORESTATE, which returns FILE to a saved state; saved set() scan position, get() record, etc, etc
* Calls FileManager.RestoreBuffer, which copies a &STRING buffer of the file previously saved over the buffer.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, sorry then for wasting your time. Unfortunately I have little ABC experience, as I am forced to use Legacy templates at work. Anyway it seems strange to me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the next situation:
Browse 1 on file 1, other tables valuta
Report 1 on file2
Source 1 other tables valuta
Window 1 no tables
Borwse 1 and Window 1 both call Report 1. Inside Report 1 Source 1 is called.
Source 1 is
do OpenFiles
clear(valuta)
val:sifra=valIn
get(valuta,val:KeyVAL)
if not errorcode()
if val:aktivnost<>'A'
clear(valOut)
clear(valuta)
else
valOut=val:sifra
end
else
clear(valOut)
clear(valuta)
end
do CloseFiles
return valOut
It appears that when calling report 1 from browse 1 the valuta buffer is cleared after do Closefiles and when it is called from Window 1 this does not happen.
When I add valuta on Report 1 other tables list all is OK.
I think that:
1. The record buffer shouldn't be cleared after Access:valuta.Close
2.Even if 1 is debatable in the case when you open twice the same table (i.e. open(valuta), open(valuta), close(valuta)…)
the Browse 1 did has the valuta on list so I do not understand.
Thanks
Nenad
Hmm; I suspect problem is that I may of implemented threading state on files incorrectly.
Whether or not a file is open is tracked on a per thread basis. But looking a Clarion 6 ABC, looks like ABC assumes tracking is global, without respect to threads.
Try this dirty hack and let me know if it improves things:
In ABFILE.INC look for Opened field in FileManager:
Opened UNSIGNED,PRIVATE
Add THREAD to it:
Opened UNSIGNED,PRIVATE,THREAD
If this works let me know, I'll look at making c2j model file state WRT threads to reflect how ABC assumes it should behave.
No, it does not work.
c2j should not be clearing the buffer after close; I have confirmed this by adding a regression test.
Suggest check file in question has THREAD flag set and dig around a bit to discover precise trigger that causes buffer to clear.
This is the definition of valuta:
valuta FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('valuta'),PRE(val),CREATE,BINDABLE,THREAD
I will try to put some log somewhere.
I have tracked down the problem.
The track is:
Filemanager.close
FileManager.noteClose
FileManager.restorefile
and then after this.file.restoreState(frm.saved.state.intValue());
the record buffer is cleared.
I do not understand :
1. Why I entered if (!this.useFile().boolValue()) since the browse procedure calling the report calling the source file has valuta table on list? Is it maybe that the indicator of file usage is reset with every procedure?
2.Why restoreState clears anyway the buffer? Shouldn't it be left as it is at the moment when close happens?
Thanks and you do not have to rush with problem solution since holidays are here. Happy holidays and if i can help with some additional information just tell.
Nenad
Excuse me. It should be:
The track is:
Filemanager.close
FileSManager.noteClose
FileManager.restorefile
I think this sounds like normal clarion behaviour when moving between procedures. On return to procedure, ABC calls WindowManager.Reset() which I think calls restore file to return file state. I regularly encounter and have to deal with this; both when compiling clarion .exe and with c2j.
restorefile is a ABC method, it by design does two things:
* calls functions RESTORESTATE, which returns FILE to a saved state; saved set() scan position, get() record, etc, etc
* Calls FileManager.RestoreBuffer, which copies a &STRING buffer of the file previously saved over the buffer.
OK, sorry then for wasting your time. Unfortunately I have little ABC experience, as I am forced to use Legacy templates at work. Anyway it seems strange to me.