Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 13 total |
update edb data after find |
Tue, Mar 29 2016 5:23 PM | Permanent Link |
kamran | Hi All
I have an ewb procedure that needs to update an edb data file (tran header total) A previous screen successfully adds this record. But the header total then needs updating. The UpdateTranHeader "Find" does not appear to work ? The data key I am trying to find is definately showing up in the edbmanager. So I know its there. It just does not locate it and I dont know why ? Any ideas ? Here is my code: procedure UpdateTranHeader; var Result:Boolean; begin // find the header to update first with fNewWash_M.WL_TranH do begin Columns['tranh_key'].SortDirection:=sdAscending; SortCaseInsensitive:=True; Sort; InitFind; showmessage('Key to find : '+ fNewWash_M.TranKey); Columns['tranh_key'].AsString:= fNewWash_M.TranKey; if Find(False,True) then begin Result:=True; DataBase.StartTransaction; showmessage('Header Match Found'+fNewWash_M.WL_TranH.Columns['tranh_key'].AsString); // update header total fNewWash_M.WL_TranH.Update; fNewWash_M.WL_TranH.Columns['tranh_total'].AsFloat:=fNewWash_M.WashTotal; fNewWash_M.WL_TranH.Save; end else showmessage('Header Match Not Found '+fNewWash_M.WL_TranH.Columns['tranh_key'].AsString); end; end; |
Wed, Mar 30 2016 4:45 AM | Permanent Link |
Walter Matte Tactical Business Corporation | Are you sure you loaded the data from the server to the EWB App?. If you replaced the FIND with a LOOP through the records testing if Columns['tranh_key'].AsString = fNewWash_M.TranKey can you find the record? Just to prove you in fact have it. Walter kamran wrote: Hi All I have an ewb procedure that needs to update an edb data file (tran header total) A previous screen successfully adds this record. But the header total then needs updating. The UpdateTranHeader "Find" does not appear to work ? The data key I am trying to find is definately showing up in the edbmanager. So I know its there. It just does not locate it and I dont know why ? Any ideas ? Here is my code: procedure UpdateTranHeader; var Result:Boolean; begin // find the header to update first with fNewWash_M.WL_TranH do begin Columns['tranh_key'].SortDirection:=sdAscending; SortCaseInsensitive:=True; Sort; InitFind; showmessage('Key to find : '+ fNewWash_M.TranKey); Columns['tranh_key'].AsString:= fNewWash_M.TranKey; if Find(False,True) then begin Result:=True; DataBase.StartTransaction; showmessage('Header Match Found'+fNewWash_M.WL_TranH.Columns['tranh_key'].AsString); // update header total fNewWash_M.WL_TranH.Update; fNewWash_M.WL_TranH.Columns['tranh_total'].AsFloat:=fNewWash_M.WashTotal; fNewWash_M.WL_TranH.Save; end else showmessage('Header Match Not Found '+fNewWash_M.WL_TranH.Columns['tranh_key'].AsString); end; end; |
Wed, Mar 30 2016 6:22 AM | Permanent Link |
kamran | Hi Walter
Thanks for the reply. To Test as you suggested ; I reload the data and then loop through it. DataBase.LoadRows( fNewWash_M.WL_TranH); ------------------------------------------------------------------------------------------------- with fNewWash_M.WL_TranH do begin First; while (not EOF) do begin showmessage('Header No'+fNewWash_M.WL_TranH.Columns['tranh_no'].AsString); Next; end; end; -------------------------------------------------------------------------------------------------------------------------------------- But it only loops until the very last record added. (except the new one) The new record I had added previosly does not show up in the loop. It however shows in the edb manager. Perhaps I am missing something obvious. I am quite new to edb and ewb (Thats my excuse anyway !!). Regards Kamran Walter Matte wrote: Are you sure you loaded the data from the server to the EWB App?. If you replaced the FIND with a LOOP through the records testing if Columns['tranh_key'].AsString = fNewWash_M.TranKey can you find the record? Just to prove you in fact have it. Walter |
Wed, Mar 30 2016 6:38 AM | Permanent Link |
Walter Matte Tactical Business Corporation | Need to understand how you added this record and who assigns the tran number (does EWB assign the tran number (the browser) or does EDB (the server).
So it means you added the record to EDB (back on server), did you close the dataset on EWB? - then you need to reload in again in EWB? If this Tran Number is assigned by EDB back on the serve then you need to reload to get these new records back into EWB. Walter kamran wrote: Hi Walter Thanks for the reply. To Test as you suggested ; I reload the data and then loop through it. DataBase.LoadRows( fNewWash_M.WL_TranH); ------------------------------------------------------------------------------------------------- with fNewWash_M.WL_TranH do begin First; while (not EOF) do begin showmessage('Header No'+fNewWash_M.WL_TranH.Columns['tranh_no'].AsString); Next; end; end; -------------------------------------------------------------------------------------------------------------------------------------- But it only loops until the very last record added. (except the new one) The new record I had added previosly does not show up in the loop. It however shows in the edb manager. Perhaps I am missing something obvious. I am quite new to edb and ewb (Thats my excuse anyway !!). Regards Kamran Walter Matte wrote: Are you sure you loaded the data from the server to the EWB App?. If you replaced the FIND with a LOOP through the records testing if Columns['tranh_key'].AsString = fNewWash_M.TranKey can you find the record? Just to prove you in fact have it. Walter |
Wed, Mar 30 2016 7:02 AM | Permanent Link |
kamran | Hi Walter
1. So the header (tranh_id,tranh_no etc..) is added by the EWB screen. The data is built (Start Transaction , Insert, Update, Save, then Commit from EWB.) At this point I am getting a message from EWB that the new header is saved ok. After inspecting the new header data at this point in edbmanager. its all there. (I have the edbmanager open as well as the EWB IDE for running and testing). 2. I then create some detail transaction records from ewb screen (a grid on ewb) by clicking on the grid and adding detail transactions until I am done. Meanwhile the header total is incrementing. Once finished I need to update the original header. This is where the problem is. I can't get to it ? There is no other coding / interaction from other sources. All in EWB. Wonder wether its to do with any pendingrequests, or databuffers, or pessimistic locking etc. (Just my random thoughts) I do not have any contraints on the data. ( I took them out as I thought it might be intefering with the find) 3. Separately ...I have not setup a master detail link yet ( I dont know how thats done in edb and how different that would be from dbisam ) Eventually the header and detail will have to link up as "Master and Detail. Is that easy to do? Regards Kamran Walter Matte wrote: Need to understand how you added this record and who assigns the tran number (does EWB assign the tran number (the browser) or does EDB (the server). So it means you added the record to EDB (back on server), did you close the dataset on EWB? - then you need to reload in again in EWB? If this Tran Number is assigned by EDB back on the serve then you need to reload to get these new records back into EWB. Walter |
Wed, Mar 30 2016 7:13 AM | Permanent Link |
Matthew Jones | kamran wrote:
> while (not EOF) do > begin > showmessage('Header > No'+fNewWash_M.WL_TranH.Columns['tranh_no'].AsString); Next; > end; Worth noting that the loop carries on while the ShowMessage appears. For this sort of logging, append to a multi-line edit box. -- Matthew Jones |
Wed, Mar 30 2016 7:15 AM | Permanent Link |
kamran | Thanks Matthew.
Good Point.. "Matthew Jones" wrote: kamran wrote: > while (not EOF) do > begin > showmessage('Header > No'+fNewWash_M.WL_TranH.Columns['tranh_no'].AsString); Next; > end; Worth noting that the loop carries on while the ShowMessage appears. For this sort of logging, append to a multi-line edit box. -- Matthew Jones |
Wed, Mar 30 2016 9:47 AM | Permanent Link |
Walter Matte Tactical Business Corporation | Do I understand:
You have a HeaderDataset and a TransactionDataset. In EWB you Start Transaction Header.Insert Header.Column['HeaderId'].AsInterger := 5; // You are NOT using AutoId - correct?. // You have some value you are assigning in the EWB code. Header.Column['xxx'].Asstring etc... other fields to load Header.Save; Commit; If you put an EditBox on the screen linked to the dataset Header and Field Header ID you should see it. Walter |
Wed, Mar 30 2016 10:10 AM | Permanent Link |
kamran | Thanks Walter
Yes that is correct a Header and a Detail 1. I will Try that to see if it works: 2. I do have an autogenerated index field on "WL_TranH.tranh_no" But I have other indexes "WL_TranH.tranh_id", "WL_TranH.tranh_key"..etc as well 3. In the meanwhile could you clarify: I am using "DataBase.LoadRows" method to load the data. eg DataBase.LoadRows(Header); But I am not using "DataBase.BaseURL" in any way ? Is that sigificant or important to use or does it just come into default use? Cheers Kamran Walter Matte wrote: Do I understand: You have a HeaderDataset and a TransactionDataset. In EWB you Start Transaction Header.Insert Header.Column['HeaderId'].AsInterger := 5; // You are NOT using AutoId - correct?. // You have some value you are assigning in the EWB code. Header.Column['xxx'].Asstring etc... other fields to load Header.Save; Commit; If you put an EditBox on the screen linked to the dataset Header and Field Header ID you should see it. Walter |
Wed, Mar 30 2016 10:49 AM | Permanent Link |
Walter Matte Tactical Business Corporation | The problem is here: Auto Generated Index. EWB (the browser) has no knowledge of the number generated because it happened on the Server when you Commit. I think Tim is going to add in the next release the ability to get this number back, (I think read that here in the forums). I wrote my own server and handle these types of processes differently. Other people have shared there AutoInc replacement to - search the forum. What I do is use Server Request to go to my server and ask for a Unique ID. Then I use that to store in the HeaderID and use it in the Detail to link to two tables. No autoinc. "But I am not using "DataBase.BaseURL" in any way ?" It is working since you are getting the data into EDB. Walter kamran wrote: Thanks Walter Yes that is correct a Header and a Detail 1. I will Try that to see if it works: 2. I do have an autogenerated index field on "WL_TranH.tranh_no" But I have other indexes "WL_TranH.tranh_id", "WL_TranH.tranh_key"..etc as well 3. In the meanwhile could you clarify: I am using "DataBase.LoadRows" method to load the data. eg DataBase.LoadRows(Header); But I am not using "DataBase.BaseURL" in any way ? Is that sigificant or important to use or does it just come into default use? Cheers Kamran Walter Matte wrote: Do I understand: You have a HeaderDataset and a TransactionDataset. In EWB you Start Transaction Header.Insert Header.Column['HeaderId'].AsInterger := 5; // You are NOT using AutoId - correct?. // You have some value you are assigning in the EWB code. Header.Column['xxx'].Asstring etc... other fields to load Header.Save; Commit; If you put an EditBox on the screen linked to the dataset Header and Field Header ID you should see it. Walter |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |