Alpha Video Training
Results 1 to 5 of 5

Thread: Field rule -posting

  1. #1
    Member
    Real Name
    Wale Lasaki
    Join Date
    Apr 2012
    Location
    Abeokuta
    Posts
    37

    Default Field rule -posting

    I have two files, let us call them A & B
    in A under field rules, i wrote instructions under Posting to post from A to B. that is OK
    But if I erase the data on file B, how can I rerun file A to post to B gain....without re entering the data afresh???
    Thanks

    Wale Lasaki

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

    Default Re: Field rule -posting

    The posting rule only goes from A to B, so it only will update B if A is changed.

    Using Ron's Authors table from THIS POST, I made a new table for B named Posting. I added an AMOUNT field to both tables, added the Author_id to Posting for the link and created a regular posting rule in A to update B.

    In the Posting field rule OnWrote field event I added this:

    dim shared get_id as c = posting->author_id

    In the OnSaveRecord event I added this:

    Code:
    dim shared get_id as c
    flag = re_post(get_id)
    if flag then
    	trace.WriteLn("Posting "+get_id,"Scripts")
    end if
    Re_post function:

    Code:
    FUNCTION re_post AS L (vid AS C )
    	re_post = .f.
    	dim t1 as p
    	dim t2 as p
    	dim recs as n = 0
    	t1 = table.open("authors",FILE_RW_SHARED)
    	t2 = table.current()
    	idx = t1.query_create("MNT","Author_id = "+quote(var->vid),"author_id")
            recs = idx.records_get()
    	if recs = 1 then
    		t2.change_begin()
    			t2.amount = t1.amount
    		t2.change_end()
    		re_post = .t.
    	end if
    	t1.close()	
    END FUNCTION
    Last edited by MoGrace; 08-22-2019 at 02:14 PM. Reason: changed script to UDF
    Robin

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

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

    Default Re: Field rule -posting

    Quote Originally Posted by lascvent View Post
    I have two files, let us call them A & B
    in A under field rules, i wrote instructions under Posting to post from A to B. that is OK
    But if I erase the data on file B, how can I rerun file A to post to B gain....without re entering the data afresh???
    Thanks

    Wale Lasaki
    Wale

    I build 2 operations to go along with a posting field rule.

    1. an update operation to set the target field to blank or zero.

    2. a posting operation to re-post all of the data from the source to the target field in the target table.

    Your comment about erase the data on file B is, I'm guessing, clearing out the field, not erasing all of the records in B.....
    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.

  4. #4
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,358

    Default Re: Field rule -posting

    In one of my Invoicing apps, I too have a "fix values" process which resets the cumulative values basd on invoices, discounts, adjustments etc as sometimes stuff goes astray.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  5. #5
    Member
    Real Name
    Wale Lasaki
    Join Date
    Apr 2012
    Location
    Abeokuta
    Posts
    37

    Default Re: Field rule -posting

    Quote Originally Posted by Al Buchholz View Post
    Wale

    I build 2 operations to go along with a posting field rule.

    1. an update operation to set the target field to blank or zero.

    2. a posting operation to re-post all of the data from the source to the target field in the target table.

    Your comment about erase the data on file B is, I'm guessing, clearing out the field, not erasing all of the records in B.....
    Yes that is what I am talking about...

Similar Threads

  1. Posting Field Rule
    By JetLi in forum Application Server Version 11 - Web/Browser Applications
    Replies: 11
    Last Post: 03-23-2012, 12:39 AM
  2. Posting Field Rule
    By johnkoh in forum Alpha Five Version 9 - Desktop Applications
    Replies: 10
    Last Post: 05-05-2011, 05:51 AM
  3. Posting Field Rule
    By enstorms in forum Alpha Five Version 9 - Desktop Applications
    Replies: 7
    Last Post: 03-05-2010, 03:03 PM
  4. Field Rule: Posting
    By gschepp in forum Alpha Five Version 9 - Desktop Applications
    Replies: 7
    Last Post: 05-20-2008, 05:00 PM
  5. Posting Field Rule
    By Kevin Tucker in forum Alpha Five Version 5
    Replies: 4
    Last Post: 01-14-2004, 09:46 AM

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
  •