Board index » delphi » SUGGEST UPDATE TECHNIQUE (dBase Field Update ERROR in One to Many LINK)

SUGGEST UPDATE TECHNIQUE (dBase Field Update ERROR in One to Many LINK)

Greetings,

After working with 16bit + Apollo for Years, I'm now attempting a
WEB/Multi-User 32bit
App with my newly purchasd Delphi 3. I've got the Data to WEB page
figured but I've
taken steps backward with Delphi 3 and my ability to control data
relations
(Apollo16BIT worked great for me but I'm attempting to grow into
developing
a SCALEABLE APP). I am self-taught as a Delphi programmer,
with some C++, Clipper, dBase...

Q: What is your suggested best approach to provide UPDATES to a
   Character dBase field which is based on multiple records from a
second Table?

FULL DISCUSSION FOLLOWS ABOUT MY ATTEMPTS BUT THE ABOVE IS THE QUESTION
IN A
NUTSHELL....
   My problem is that the OnCalculated Field of Table1 isn't properly
   updating the TABLE1Temporay Field from the LINKED Table2 Table.
   (sometimes OnCalc Fires and sometimes it doesn't, mainly because I
based the
   update on the ID Field between the two tables being equal, I assume
it is
   because the LINKED update actually occurs procedurally after the
OnCalc Event)
   So whats the PRESCRIBED method?

MY BASIC APPROACH SO FAR...  
                        BASIC STRUCTURE
        Table1 dBase Structure                  Table2 dBAse Structure
        ID,C,16 ---------------linked----->  ID,C,16         (+Indexed MDX)
        ITEM_DESC,C,64                          SCHED_DATE,D,10
        TIMESCHED,C,48 (OnCalc Field)           TIMESTART,N,4
                                                TIMEEND,N,4
                                                TIME_BAR,C,48

        Table1 is LINKED to Table2 via the ID. Browsing in DBGrid looks good
But
        the OnCalc Event isn't updating every Field. Some are skipped,
Others
        erroneously updated.

        From the OnCalculated Event I've attemped to update the TIMESCHED with
        code as follows:
        Form1.Table1OnCalc.......
        begin
           If Table1.Active then
              If Table1ID.AsString=Table2ID.AsString then
                 Table1TIMESCHED.AsString:=Table2TIME_BAR.AsString;
        end;

Any Help would be appreciated. I had hoped to create something beautiful
but
my efforts have reached a dead end....

Thanks,
Reece
ebat...@awod.REMOVE_MEcom

 

Re:SUGGEST UPDATE TECHNIQUE (dBase Field Update ERROR in One to Many LINK)


Quote
>  My problem is that the OnCalculated Field of Table1 isn't properly
>   updating the TABLE1Temporay Field from the LINKED Table2 Table.
>   (sometimes OnCalc Fires and sometimes it doesn't, mainly because I
>based the
>   update on the ID Field between the two tables being equal, I assume
>it is
>   because the LINKED update actually occurs procedurally after the
>OnCalc Event)

In an OnCalc field you can not rely on delphi to link a detail table.
you will need to use a second Ttable and Findkey or setRange to locate
the apropriate record for your calculation

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads