I have an embeded browse - example in jpg below. It has a few colour equation columns and also a button which sends an email. It all works well and I would now like to have the email automatically sent when the colour equation is satisfied. I am thinking this might be via an onSave event, but I don't know how to marry the expression with the code - or even if I'm going in the best direction. Examples of my current expression and email code are below.
Many thanks.
1.JPG
Example colour equation:
(Call_Detail->Date_Op<=(previous("Call_Detail->Date_Op")+7))
.AND.(previous("Call_Detail->Code")="EM".AND.Call_Detail->Code="EM")
email code:
this.Set_Viewport_row(row)
if this.Table_Get().Mode_Get() > 0 then
this.Commit()
end if
function Actions_ButtonClick as v( event as C,data as C, row as N)
'get value into variable
dim compiled_values as C
compiled_values="Company: " + parentform:Browse1:Company.value +chr(10)
' + "Add1: " + parentform:Browse1:add1.value +chr(10) + "Town: " + parentform:Browse1:town_city.value +chr(10)
msgbox(compiled_values)
'email the info
dim pm as P
dim ps as P
if (email_smtp_open(ps,"mail.m-press.biz", 25, "lgordon", "mrmmouse")) then
pm.to = "[email protected], [email protected]"
pm.cc = "[email protected]"
pm.from = "[email protected]"
pm.subject = "Alpha Message"
pm.message = compiled_values
pm.attachments = ""
'pm.html_message = "<b>New Service Call</b>"
email_smtp_send(pm,ps)
end if
email_smtp_close(ps)
end function
Many thanks.
1.JPG
Example colour equation:
(Call_Detail->Date_Op<=(previous("Call_Detail->Date_Op")+7))
.AND.(previous("Call_Detail->Code")="EM".AND.Call_Detail->Code="EM")
email code:
this.Set_Viewport_row(row)
if this.Table_Get().Mode_Get() > 0 then
this.Commit()
end if
function Actions_ButtonClick as v( event as C,data as C, row as N)
'get value into variable
dim compiled_values as C
compiled_values="Company: " + parentform:Browse1:Company.value +chr(10)
' + "Add1: " + parentform:Browse1:add1.value +chr(10) + "Town: " + parentform:Browse1:town_city.value +chr(10)
msgbox(compiled_values)
'email the info
dim pm as P
dim ps as P
if (email_smtp_open(ps,"mail.m-press.biz", 25, "lgordon", "mrmmouse")) then
pm.to = "[email protected], [email protected]"
pm.cc = "[email protected]"
pm.from = "[email protected]"
pm.subject = "Alpha Message"
pm.message = compiled_values
pm.attachments = ""
'pm.html_message = "<b>New Service Call</b>"
email_smtp_send(pm,ps)
end if
email_smtp_close(ps)
end function
Comment