Alpha Video Training
Results 1 to 16 of 16

Thread: Field Record Events

  1. #1
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    242

    Default Field Record Events

    I posted this on the web board, with no response so I am trying here:-

    I am using / developing a UX with tabs to populate a dbf tab by tab.
    As each tab is completed the data is (re)submitted and certain Field Rules / Record events are fired.
    The problem is that I keep losing the Record Events when editing. Editing cansave the onsave events will disappear, which I don't see until the ux starts to show odd behaviour, so I then have to restore field rules & start again.
    What is the problem with the stability of the Field rules? - could be on the wrong board for this.
    Is my approach wrong in using this method, should I perhaps be firing some script from the UX, or something else/
    I am using a dbf as this is also part of our desktop system.
    Thanks
    Terry

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Field Record Events

    The field rules are stored in the dbf's data dictionary files.

    Data Dictionary
    .DDD
    The table's data dictionary, which contains lists of additional table objects such as Layouts (forms, browses, etc.), report designs, saved operations, field rules, and field names longer than 10 characters.
    Dictionary Methods, Reading From and Writing To the Data Dictionary

    .DDM
    Stores additional table objects such as Layouts (forms, browses, etc.), report designs, and saved operations in memo format.

    .DDX
    Contains the dictionary's index(es). Alpha Five uses the .ddx to find a specific form name or field rule or whatever is needed.
    So it seems something is messing with those files. Having no clue what a UX is or does I can't offer any advice.
    There can be only one.

  3. #3
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    242

    Default Re: Field Record Events

    Any suggestions on how I can fix these, I have already tried a compact but the problem still persists.
    Is there a way to delete all record events & then I could start building them again?
    I tried moving the code to a global script, and then running that script from the record event but that doesn't seem to work with the same code - perhaps someone could tell me what is wrong with this method.
    Thanks
    Terry

  4. #4
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Field Record Events

    i do not do dbf nor desktop, since this is pertaining to ux/dialog in web application i am trying to answer the question:
    why don't you add code in the web side afterDialogValidate event on submitting the record to do what you want to do?
    if you post a screencast of the ux with tabs and how you are submitting the ux, i can try to think of some ideas for you to consider.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  5. #5
    Member
    Real Name
    Craig Schumacker
    Join Date
    May 2000
    Posts
    687

    Default Re: Field Record Events

    Terry:

    It's not, I do not believe, an issue with the events themselves not firing. And I also don't think it's a stability issue with Alpha.

    Not to say Alpha doesn't have quirks, but I'm in one version or another of this software 6 hours a day for some 15 years. I'm not implying to be an expert - just that I've traveled this path a few times myself. It can be frustrating, as you already know, but Alpha itself is pretty stable.

    Now, let's focus on the quirks in the events overlay.

    Getting a group or series of events to work harmoneously can be trying, and this is, my guess, where your issue is.

    It's not you, or your fault, by the way. Anyone with a flow of events at the form, field, and record level can experience this.

    Some issues are documented, as exampled, a Can event (cancel()) can be tricky to get to work, as anything changing focus resets an internal variable in Alpha so the cancel() never takes place.

    From my own experience, I find that by adding a few ui_msg_boxes, and using the Trace window can help to isolate where the flow of events is being disrupted. The problem can also be a form event disrupting a record or field event.

    Start by looking at any Cancel() events, and look to see if there may be a msg box or .Activate that prevents the cancel.

    Try writing down what the true sequence of events should be (Flow Chart), the determine at what point it deviates from that path by adding msg boxes or writing to the trace window. Then, look at the code in that area and try alternating your logic.

    Patience will get you through this....

  6. #6
    Member
    Real Name
    Craig Schumacker
    Join Date
    May 2000
    Posts
    687

    Default Re: Field Record Events

    Re-reading your post, I have had field and record events disappear, too. They are still there, and re-appear after a compact or closing / re-opening Alpha.

    I guess it's a bit early for me, as I didn't pick up that your talking web components here in the desktop board. I found, in my expereiences with web components and field rules, that the two are not meant to be paired. While some field rules are enforced, others are not, for example.

    Take my prior post and shelve it... you probably need to limit any data enforcement to the component level on the web side.

  7. #7
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    242

    Default Re: Field Record Events

    To add some clarity
    The UX reference is perhaps a red herring
    The field record events are working fine.
    My issue is that when I edit the field record events I experience the loss of them I.e if I edit cansave & save the field rules, they save but the existing onsave events disappear.
    This is either a problem with the table (I have tried compacting) or it is a bug.
    I hope this aids those who are trying to help me.
    Thanks

  8. #8
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Field Record Events

    My issue is that when I edit the field record events I experience the loss of them I.e if I edit cansave & save the field rules, they save but the existing onsave events disappear.
    actually, this should have been in the database design forum, few forums down.
    there are many people who are experts in desktop side and i am sure you will get an answer.
    good luck.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  9. #9
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,949

    Default Re: Field Record Events

    Like Stan, I do not do web programming, and I do not even know what a UX component is. And I also don't know if you are using DBF's or SQL.

    However, to use field rules in DBF's, there are certain things you need to know and understand. Mainly, and most importantly (if you are using the cansaverecord event or the canwritefield events) is where is the data.

    You have a hard drive that contains records for a table.
    When you are entering or editing a given record, before it is saved the new changed data is not on the hard drive; it is in a record buffer in memory.

    And if, in the cansaverecord event, you say in code "if such-and-such is true then cancel (don't save the record) and alert the user that they have made a mistake, and their changes were not saved" - then those changes will not be written the hard drive.

    However, if you are using the canwritefield event, it is different. Since the field has not yet been written to the record in the buffer, where is it? It is in a_field_value.value. And at this point you do not want it to get to the record buffer in memory. And you cannot reference the field itself, you have to reference a_field_value.value.

    In other words, you could not say
    t=table.current()
    if t.first_name is "Mary" - because you would referencing the value in the record buffer, not the field itself.

    I usually get the value of a_field_value.value into a variable, and examine it, and write code to deal with it.

    So ....
    If you are entering a new record, all values are in a temporary record buffer in memory.
    If you are editing a record all previous values are in the record buffer.
    If you are editing a field, until you write the field (to the record buffer) the value is in a_field_value.value.

    If I had more time I could post examples of using a_field_value.value, but its pretty simple once you understand where the data is.

    As for field rules, most will fire only if the record is being entered or edited in a form or browse. Autoincrement and calculated fields are exceptions.

    So ... when you are writing code in a script, then most field rules will not fire. Supposedly, (although I have not tried it yet,) if you say t.change_begin(.t.) and t.change_end(.t.) the rules will fire in independent scripts.

    As for field rules disappearing, you most likely have a corrupted dictionary for the table in question. Way back in maybe version 9 we used to have that problem, although I have not heard of if in many years. I would make a new table, append the data to the new table, delete the old table, and then add all the field rules to the new table and rename it to the old table name.
    Last edited by martinwcole; 08-02-2015 at 03:57 PM.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  10. #10
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    242

    Default Re: Field Record Events

    My field record events all work fine and fully understand the record buffer, my problem is just the disappearing field rules and these are restricted to only disappearing field record events.
    Looks like a rebuild will be necessary. Is there a way to create a list of all the rules for a table?
    Thanks

  11. #11
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Field Record Events

    my problem is just the disappearing field rules
    out of curiosity, I tested in version 11 the field level event did not disappear no matter how many times I edited and saved one rule the other one remained the same.
    if you can reproduce the same and take a screencast and show, that would be helpful.
    the web and ux, even though red herring may be, confusing others even long time veterans like martin cole.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  12. #12
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,949

    Default Re: Field Record Events

    email Finian.lennon@gmail.com. he knows how to get all the field rule events - maybe put in a text file - although he may charge you for his time - would take some time to write a script to save and then auto reapply.

    are you working with SQL in this? if so how are you using dbf field rules?
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  13. #13
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,949

    Default Re: Field Record Events

    Talked to Finian, and we both agree that if you have a corrupted data dictionary, then you should manually renter all the rules. Otherwise you risk copying the corruption from the old table to the new one. But don't reenter them to the existing table - make a new table and enter them there.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  14. #14
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,563

    Default Re: Field Record Events

    Duplicating a table will rebuild all of the records and the support files.

    this usually cleans up problems....

    Steps.

    Backup - Backup - Backup

    Right click table - select Utilities - Duplicate the table to a new name. Select all check boxes.

    Check the field rules in the new table.

    Remove the original table and rename new table to the original name.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  15. #15
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,994

    Default Re: Field Record Events

    In the event Al's method does not work for everything,

    This is harder!
    Check NO boxes. all you want is the fields with same names as the old table.
    Rebuild your indexes, field rules, append the data to the new table, use copy-to for all forms, reports, etc. to get them to the new table.
    delete old table, rename new table to old table name.

    If still a problem.
    create new table and paste the fields from the old table that you copied with drag/click. Then do the rest by hand and append.
    Dave Mason
    dave@aldaweb.com

    Skype is dave.mason46

  16. #16
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,595

    Default Re: Field Record Events

    Has anybody here even seen the errant table? The advice given here sounds like an awful lot of trouble to go thru when no data has even been presented! His error could be caused by any number of things that even a spell checker might fix... Why assume the field rules are correct without knowing what conflict may exist?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. UX & Field Record Events
    By Terrymorgan in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 07-23-2015, 04:39 AM
  2. Field Rules - Field Events & Record Events
    By SNusa in forum Alpha Five Version 11 - Desktop Applications
    Replies: 35
    Last Post: 01-08-2013, 01:06 AM
  3. Field Rules Record events mix up
    By G Gabriel in forum Alpha Five Version 7
    Replies: 6
    Last Post: 09-14-2006, 02:00 PM
  4. Field / Record Events
    By Bill Lewis in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-13-2004, 12:07 PM
  5. Field Rule Record Events
    By Stephen Williams in forum Alpha Five Version 4
    Replies: 6
    Last Post: 12-02-2000, 12:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •