Do not let any software impress you!

Only let it convince your intellect.
Slider img 1
Do not look for a business paradise!

It is a waste of time.
Slider img 2
Only yourself can push you uphill.

There is no easy road to prizes.
Slider img 3
Productivity is the name of the game.

And you have to conquer it.
Slider img 4
As long as you understand it,

you will start to build your know-how.
Slider img 5
We can help with that.

We have the tools and the method.
Slider img 6

Prompt
Data
Associate
Role
Contact
Mail Address
Done
Comments
Subject
Requester
Contact
Then by clicking on edit fields (helding donw ctrl button) you can
Role
Associate
Requester
Sending Email
Mail Subject
Done
Open the form that you wish to collect data from
Data Items to Collect
select or deselect fields for data collecting

Title : AU_DATACOLLECT

Toolbars

call BrowseEditInsert()
call BrowseEditDoVKUp(fld_id,fld_val,key)
call BrowseEditDoVKDown(fld_id,fld_val,key)
call BrowseEditDelete()
call CloseForm(True)
call CloseForm(False)

Buttons

Fields


 (AU_DATACOLLECT_ITM.FLD_PROMPT)
 (AU_DATACOLLECT_ITM.FLD_NAME)
 (AU_USER.UNAME)
 (AU_POS.POS_D)
 (AU_CONTACT.DISP_NAME)
 (AU_MAILADDRESS.MADDRESS)
 (AU_DATACOLLECT_ITM.DONE_FLAG)
Comments (AU_DATACOLLECT.COMM)
Subject (AU_DATACOLLECT.SUBJECT)
Requester (AU_USER.UNAME)
Contact (AU_CONTACT.DISP_NAME)
Role (AU_POS.POS_D)
Associate (AU_USER.UNAME)
Requester (AU_MAILADDRESS.MADDRESS)
Sending Email (AU_DATACOLLECT.SUP_MAIL)
Mail Subject (AU_DATACOLLECT.MAIL_SUBJECT)
Done (AU_DATACOLLECT.DONE_FLAG)


AutoScript

lib

proc Form_Start()

     f = TopForm()
     task = FormTask(f)
     p = PByName(f,"AU_DATACOLLECT")
     t = TByName(p,"AU_DATACOLLECT")
     p = PByName(f,"AU_DATACOLLECT_ITM")
     ti = TByName(p,"AU_DATACOLLECT_ITM")

     if (task = ptAppend) then
        call OnOpenForm_ShowControl("LAB1")
        call OnOpenForm_ShowControl("LAB2")
        call OnOpenForm_ShowControl("LAB3")
     else
        call OnOpenForm_HideControl("LAB1")
        call OnOpenForm_HideControl("LAB2")
        call OnOpenForm_HideControl("LAB3")
     endif

     if (task = ptAppend) then

        call TEdit(t)
        call TSetFld(t,"SELECT_STAGE_FLAG","1")
        call TPost(t)
        call ReLoadEditFields(f)

     endif

     start_sql "CONTACT_SEL" "KOSMOS"
       SELECT AU_CONTACT.DISP_NAME, AU_MAILADDRESS.MADDRESS,
       AU_MAILADDRESS.AU_MAILADDRESS, AU_CONTACT.AU_CONTACT
       FROM (AU_CONTACT INNER JOIN AU_CONTACT_MAILADDR
       ON AU_CONTACT.AU_CONTACT = AU_CONTACT_MAILADDR.AU_CONTACT)
       INNER JOIN AU_MAILADDRESS ON AU_CONTACT_MAILADDR.AU_MAILADDRESS = AU_MAILADDRESS.AU_MAILADDRESS
       WHERE (AU_CONTACT.DISP_NAME LIKE :E & '%')
       ORDER BY AU_CONTACT.DISP_NAME
     end_sql
     start_sql "MAIL_SEL" "KOSMOS"
       SELECT AU_MAILADDRESS.MADDRESS, AU_CONTACT.DISP_NAME, AU_MAILADDRESS.AU_MAILADDRESS
       FROM (AU_CONTACT INNER JOIN AU_CONTACT_MAILADDR
       ON AU_CONTACT.AU_CONTACT = AU_CONTACT_MAILADDR.AU_CONTACT)
       INNER JOIN AU_MAILADDRESS ON AU_CONTACT_MAILADDR.AU_MAILADDRESS = AU_MAILADDRESS.AU_MAILADDRESS
       WHERE (AU_CONTACT.AU_CONTACT = :C)
       AND (AU_MAILADDRESS.MADDRESS LIKE :E & '%')
       ORDER BY AU_CONTACT.DISP_NAME
     end_sql

end

{============================== Query Parameters ===================}

proc Select_CONTACT_SEL_Params()

   s = GetEditedText()
   call ParamsEmbSQL("CONTACT_SEL",s)

end

proc Select_MAIL_SEL_Params()

   s = GetEditedText()
   c = TGetFld(ti,"AU_CONTACT")
   call ParamsEmbSQL("MAIL_SEL",c,s)

end

{============================ Form_OnSelect ===========================}

proc Form_OnSelect (tname, fldname, str, tt, oldstr, sq )

     if (tname = "AU_CONTACT") then

        mai_id = TGetFld(sq,"AU_MAILADDRESS")
        mail_add = TGetFld(sq,"MADDRESS")

        call TEdit(tt)
        call TSetFld(tt,"AU_MAILADDRESS",mai_id)
        call TSetFld(tt,"F_AU_MAILADDRESS_MADDRESS",mail_add)
        call TPost(tt)

        call ReLoadEditFields(f)

     endif
end

{================================== Form_BeforeClose ===========================}

fun Form_BeforeClose()

    result = 1

    comm = TGetFld(t,"SUBJECT")
    comm = Copy(comm,1,80)

    {...................................check main record.....}
    user_id = TGetFld(t,"AU_USER")
    pos_id = TGetFld(t,"AU_POS")
    con_id = TGetFld(t,"AU_CONTACT")
    mail_id = TGetFld(t,"AU_MAILADDRESS")

    sum = 0
    if (user_id > 0) then
       sum = sum + 1
    endif
    if (pos_id > 0) then
       sum = sum + 1
    endif
    if (con_id > 0) then
       sum = sum + 1
    endif

    if (sum > 1) then
       call message("You must define only one supplier of data item (Associate, Role or Contact)")
       result = 0
       return
    endif

    count = TRecordCount(ti)

    if (sum = 1) then    {.........give values to detail}

       call TFirst(ti)
       for i = 1 to count

         call TEdit(ti)
         call TSetFld(ti,"AU_USER",user_id)
         call TSetFld(ti,"AU_POS",pos_id)
         call TSetFld(ti,"AU_CONTACT",con_id)
         call TSetFld(ti,"AU_MAILADDRESS",mail_id)
         call TPost(ti)

         call TNext(ti)
       next
       call ReLoadEditFields(f)

    endif

    {..........................check for detail valitity..}
    call TFirst(ti)
    for i = 1 to count
        user_id = TGetFld(ti,"AU_USER")
        pos_id = TGetFld(ti,"AU_POS")
        con_id = TGetFld(ti,"AU_CONTACT")

        sum = 0
        if (user_id > 0) then
         sum = sum + 1
        endif
        if (pos_id > 0) then
         sum = sum + 1
        endif
        if (con_id > 0) then
         sum = sum + 1
        endif

        if (sum = 0) then
         call message("You must define one supplier of data item (Associate, Role or Contact) in line ",i)
         result = 0
         return
        endif
        if (sum > 1) then
         call message("You must define only one supplier of data item (Associate, Role or Contact) in line ",i)
         result = 0
         return
        endif

        call TNext(ti)
    next

end

{================================== Form_End ===========================}

proc Form_End ( uvalue )

     if (task = ptAppend) then

        call bpm_startcoordinator ( "AU_DATACOLLECTOR_COORDINATOR", uvalue )

     else

        call bpm_clientchangescomments(f,comm)

     endif

end