Alpha Video Training
Results 1 to 13 of 13

Thread: Recalculating field posting rules

  1. #1
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Recalculating field posting rules

    Hello,

    We are trying to do the following:

    OnRecordChange : re-evaluate the posting rule for field 'a'

    Is there a function or other means of accomplishing this task easily?

    I have done multiple searches throughout the Xbasic Reference and could only find the following.

    .RECALC_CALCFIELDS()

    The field that we wish to have the posting rules re-evaluated is not a calculated field. It is a user typein field.

    Thanks
    Cheryl

  2. #2
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    I found the following as well:

    .UPDATE()

    This looks like it would work but we would need one on the RECORD level vs the TBL level.

  3. #3
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    The only thing we have been able to come up with so far is to create calc fields and work with those. Seems like there should be an easier way to work with existing fields so we are still open to any other suggestions.

  4. #4
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,628

    Default RE: Recalculating field posting rules

    Cheryl

    Can you describe what you are trying to accomplish? What I'm seeing is a question about a proposed solution to some other undescribed problem.

    There may be another solution, if we know the problem.

  5. #5
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    Hi Al,

    We have a 'qty' field in our orders table that we have field rules for which will update the committed field in our inventory table. We want the field rules in that 'qty' field to recalculate when the shipping date or status field are changed in the orders table to reverse the prior posting to the committed field in the inventory table.

    I have not been able to find any functions that would allow us to do this with the exception of the recalc on calc fields, but the qty field is a usertyped field. The only option we have been able to think of is to create calculated fields in the order table that will hold all the different products and use those fields to recalculate.

    Hope that makes sense, not real sure how to explain it otherwise. Thanks in advance for any suggestions you may have.

    Cheryl

  6. #6
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,628

    Default RE: Recalculating field posting rules

    Cheryl

    You may want to consider adding records to a transaction table that show the changes and when they occur, rather than having a single record that keeps changing.

    It's always good to have an audit trail, so you can reconstruct the events that lead you to the current time.

    It will also make the posting field rules work.

    Two birds with one stone.....

    Have a great weekend!

  7. #7
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    Hi Al,

    Thanks for all your assistance so far. We are using a memo field to track all transactions that we need an audit trail for which has worked for our needs to date. I looked up the field rule which is on the 'qty' field in the orders table: Date_Ship>{}.and.(status="".or.status="R")

    The problem we are running into is that the data in the qty field does not change, it is when we change the date ship or the status field that we need the posting rule in the qty field to recalculate.

    The current posting rule is working properly and returning the results that we are looking for. What we want to be able to do is the following:

    When I process credit card orders, the shipping date
    gets filled in with the current date, or the status
    field will get a D for declined credit cards and
    cancel this order. When one or both of these fields
    change, we need the qty field to re-calculate and
    reverse the posting that it originally made to the
    committed field ... hence, decreasing the committed
    field in the inventory table as if it never happened
    in the first place.

    Thanks
    Cheryl

  8. #8
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    OK, we went ahead and created a calculated field so that we could re-calculate the quantity for inventory purposes when the ship date or status changes in a record. Unfortunately it only reads the fields posting rules when we update a record manually. If we run our credit card update operation it accurately updates the calculated field but does NOT post the changes to the inventory table. Our thought is that it does not read the posting rules in the field during the update query maybe because somewhere this is set to not read them? The update operation runs through thousands of records within seconds so it makes sense that it is 'ignoring all posting rules'. If this is in fact correct, does anybody know how to 'override' this default setting and have it read the posting rules?

    Thanks again in advance for any assistance.
    Cheryl

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Recalculating field posting rules

    Cheryl, some field rules are 'engine level' rules, enforced for the table whether data entry is occuring through a form or not. Others only work when data entry occurs through a form or browse ("UI level"). Which is which has always been a bit nebulous for me. Your description sounds like the post field rule is not an 'engine level' field rule.

    Consider the following quote discussing the 'honor field rules' flag in the tbl.enter_begin() method:

    Field_Rules_Flag is an optional parameter. If flag is .T., or is set to HONOR_FIELD_RULES, then "UI level" field rules are enforced when the record is entered (only under special circumstances – see Note below). If the Field_Rules_Flag is .F., then Alpha Five does not enforce these "UI level" field rules. "UI level" field rules are rules such as trigger events, capitalization, minimum and maximum values, masks/templates, lookup fill-ins etc. "Engine level" rules, such as auto-increment values are always enforced.

    A discussion of which field rules are 'UI level' and which are 'engine level' would be a good topic for the newsletter.

    An alternative you may wish to try would be to look at the xbasic code beneath your operation to see if the 'honor_field_rules' flag is being set when your table is opened.

    -- tom


  10. #10
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    Hi Tom,

    Thanks for the info. There is nothing in the operation code that refers to that flag. Do you think it is possible for me to add it directly into this code and force the field rules to be followed for this one particular field? If so, could you provide me with the syntax that I should use and where I should place it? Your assistance is greatly appreciated.

    Thanks
    Cheryl

  11. #11
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Recalculating field posting rules

    Cheryl, sorry, no. The code you've posted reminds me that the 'update' operation uses a high level utility programmed by the wizards at Alpha Software to do the heavy lifting. We don't have access to its inner workings. Unless someone else has a better idea (and I'll be watching along with you) I fear you're going to have to write a custom version of the update operation from scratch, which includes the posting functionality you need.

    -- tom

  12. #12
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    So Selwyn, any chance the wizards can give us the inside scoop so that I can get the update to NOT ignore the field rules and post?

  13. #13
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Recalculating field posting rules

    >>>>yanks all the hair out of my head

    I have tried an update operation to post to the inv table and have also been playing around with a post operation, not matter what I try I am unable to get the inv data to change :(

Similar Threads

  1. Field Rules - Posting
    By Jenny Lynch in forum Alpha Five Version 6
    Replies: 8
    Last Post: 02-07-2005, 10:59 PM
  2. Posting - Field Rules
    By Kevin Anderson in forum Web Application Server v6
    Replies: 2
    Last Post: 09-10-2004, 05:05 PM
  3. field rules - posting
    By rbierman@iowbar.org in forum Alpha Five Version 5
    Replies: 4
    Last Post: 09-14-2003, 07:59 PM
  4. Posting Operation in Field Rules
    By Chris Donelon in forum Alpha Five Version 5
    Replies: 8
    Last Post: 02-13-2003, 09:11 AM
  5. posting using field rules
    By nick marodis in forum Alpha Five Version 4
    Replies: 2
    Last Post: 05-31-2000, 01:12 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
  •