Browsing Form 1
This example shows the code of a browsing form that takes data directly from the database‘s “select“ query. Almost all the code is created automatically during the creation of the form.
We take this example code from the form “Activities in Progress“ (AU_BPM_JOBS3.FM). Here, the procedures Lst_DblClick, Form_Start, Panels_Start are standard procedures for AutoPilot code into a form. The Flowchart procedure is developer-defined activated in a toolbars button pressing. Note the keyword lib at the top of the code that makes all variables having global visibility over the entire code unit.
lib
proc Lst_DblClick()
call OpenBPMStep()
end
proc Form_Start()
f = TopForm()
call SetRefreshTimer(f,30)
call SetCaption(“Activities in Progress“)
end
proc Panels_Start()
start_sql “DATA“ “KOSMOS“
SELECT
AU_STEP.STEP_DESCR, AU_STEP.STEP_CODE, AU_STEP.AU_STEP, AU_STEP.STEP_ID,
AU_STEP.TOSTART_AT_DATE, AU_STEP.TOSTART_AT_TIME,
AU_STEP.BRANCH_ID, AU_STEP.ASSIGNED_AT_DATE, AU_STEP.ASSIGNED_AT_TIME,
AU_PROCESS.AGENT_NAME, AU_PROCESS.AGENT_ID, AU_STEP.FINISHED_AT_DATE,
AU_STEP.FINISHED_AT_TIME, AU_STEP.UNAME AS STEP_UNAME, AU_STEP.COMM,
AU_STEP.FINISHED, AU_STEP.AU_PROCESS, AU_STEP.RNAME, AU_STEP.UNAME,
AU_PROCESS.PARENT_AGENT_ID
FROM
AU_PROCESS INNER JOIN AU_STEP ON AU_PROCESS.AU_PROCESS = AU_STEP.AU_PROCESS
WHERE (((AU_STEP.FINISHED)=0 Or (AU_STEP.FINISHED) Is Null))
ORDER BY AU_STEP.ASSIGNED_AT_DATE, AU_STEP.ASSIGNED_AT_TIME,
end_sql
q = QueryByName(“DATA“)
user = GetUserName()
call TSetParam(q,“U“,user)
call TPrepare(q)
end
proc Flowchart()
name = getfprevfield(“AGENT_NAME“)
id = getfprevfield(“AGENT_ID“)
fullname = strcat(name,“.“,id)
call agent_flowchart(fullname)
end