A little help. The following script works in the Interactive window. However
t does not run when pasted in to the grids AfterUpdateRecords window.
a_tbl = table.open("[PathAlias.ADB_Path]/debtoraccount")
ON ERROR GOTO ERROR04042009095918678
post.t_db = "[PathAlias.ADB_Path]/payments"
post.m_key = "str(ACCOUNTID,19,0)"
post.t_key = "str(ACCOUNTID,15,0)"
post.m_filter = ""
post.t_filter = "Posted='YES'"
post.m_count = 2
post.m_field1 = "Totalpay"
post.m_exp1 = "Totalpay+@Payments->Paymentamt"
post.m_field2 = "Baldueacct"
post.m_exp2 = "Baldueacct-@Payments->Paymentamt"
post.t_count = 1
post.t_case1 = "VIOLATED"
post.t_field1 = "@Payments->Posted"
post.t_exp1 = "\"FAILED\""
'Prompt for confirmation before running the Operation.......
dim rec_count as n
rec_count = a5_get_records_in_query("[PathAlias.ADB_Path]/payments",post.t_filter,-1,.f.)
a_tbl.post()
GOTO CONTINUE04042009095918678
ERROR04042009095918678:
ON ERROR GOTO 0
END
CONTINUE04042009095918678:
a_tbl.close()
DIM Append as P
a_tbl = table.open("[PathAlias.ADB_Path]/notes")
append.t_db = "[PathAlias.ADB_Path]/payments"
ON ERROR GOTO ERROR0404200910052748
append.m_key = ""
append.t_key = "recno()"
append.m_filter = ""
append.t_filter = "Posted=\"YES\""
append.type = "All"
append.m_count = 5
append.m_field1 = "NOTE"
append.m_exp1 = "\"$\"+@PAYMENTS->Paymentamt+\" was posted to the account on \"+ date() +\"by: \"+@Payments->Ownership"
append.m_field2 = "ACTION"
append.m_exp2 = "\"POS\""
append.m_field3 = "RESULT"
append.m_exp3 = "\"POS\""
append.m_field4 = "Userid"
append.m_exp4 = "@PAYMENTS->Ownership"
append.m_field5 = "Accountid"
append.m_exp5 = "@PAYMENTS->Accountid"
append.t_count = 1
append.t_case1 = "APPENDED"
append.t_field1 = "@Payments->Posted"
append.t_exp1 = "\"Posted\""
'Prompt for confirmation before running the Operation.......
dim rec_count as n
rec_count = a5_get_records_in_query("[PathAlias.ADB_Path]/payments",append.t_filter,-1,.f.)
a_tbl.append()
GOTO CONTINUE0404200910052748
ERROR0404200910052748:
ON ERROR GOTO 0
END
CONTINUE0404200910052748:
a_tbl.close()
t does not run when pasted in to the grids AfterUpdateRecords window.
a_tbl = table.open("[PathAlias.ADB_Path]/debtoraccount")
ON ERROR GOTO ERROR04042009095918678
post.t_db = "[PathAlias.ADB_Path]/payments"
post.m_key = "str(ACCOUNTID,19,0)"
post.t_key = "str(ACCOUNTID,15,0)"
post.m_filter = ""
post.t_filter = "Posted='YES'"
post.m_count = 2
post.m_field1 = "Totalpay"
post.m_exp1 = "Totalpay+@Payments->Paymentamt"
post.m_field2 = "Baldueacct"
post.m_exp2 = "Baldueacct-@Payments->Paymentamt"
post.t_count = 1
post.t_case1 = "VIOLATED"
post.t_field1 = "@Payments->Posted"
post.t_exp1 = "\"FAILED\""
'Prompt for confirmation before running the Operation.......
dim rec_count as n
rec_count = a5_get_records_in_query("[PathAlias.ADB_Path]/payments",post.t_filter,-1,.f.)
a_tbl.post()
GOTO CONTINUE04042009095918678
ERROR04042009095918678:
ON ERROR GOTO 0
END
CONTINUE04042009095918678:
a_tbl.close()
DIM Append as P
a_tbl = table.open("[PathAlias.ADB_Path]/notes")
append.t_db = "[PathAlias.ADB_Path]/payments"
ON ERROR GOTO ERROR0404200910052748
append.m_key = ""
append.t_key = "recno()"
append.m_filter = ""
append.t_filter = "Posted=\"YES\""
append.type = "All"
append.m_count = 5
append.m_field1 = "NOTE"
append.m_exp1 = "\"$\"+@PAYMENTS->Paymentamt+\" was posted to the account on \"+ date() +\"by: \"+@Payments->Ownership"
append.m_field2 = "ACTION"
append.m_exp2 = "\"POS\""
append.m_field3 = "RESULT"
append.m_exp3 = "\"POS\""
append.m_field4 = "Userid"
append.m_exp4 = "@PAYMENTS->Ownership"
append.m_field5 = "Accountid"
append.m_exp5 = "@PAYMENTS->Accountid"
append.t_count = 1
append.t_case1 = "APPENDED"
append.t_field1 = "@Payments->Posted"
append.t_exp1 = "\"Posted\""
'Prompt for confirmation before running the Operation.......
dim rec_count as n
rec_count = a5_get_records_in_query("[PathAlias.ADB_Path]/payments",append.t_filter,-1,.f.)
a_tbl.append()
GOTO CONTINUE0404200910052748
ERROR0404200910052748:
ON ERROR GOTO 0
END
CONTINUE0404200910052748:
a_tbl.close()
Comment