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
Bookmarks