Subject oodml coversion
From Charlie <trainman@traincity.com>
Date Sun, 22 May 2016 03:05:14 -0400
Newsgroups dbase.getting-started

I am starting to convert this xdml code to oodml code.

I believe there may be a couple of ways to do this.  As you can see in xdml I have several filters set based on what radio button is selected.  Can I filter in a similar way in oodml or would I be better off to define each filter  in new queries?  

Please note I've just started this so I realize there is still xdml showing.

//emailoodml.wfm selects email
//sele a
//use data\emailwin.dbf exclusive
//sele b
//use data\nazdata order lname
set safety off
** END HEADER -- do not remove this line
//
// Generated on 03/09/2016
//
parameter bModal
local f
f = new emailForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class emailForm of FORM
   with (this)
      height = 16.0
      left = 36.0
      top = 3.4091
      width = 37.8571
      text = "EMAIL OPERATION"
      autoCenter = true
      mdi = false
      contextHelp = true
   endwith

   this.NAZDATA1 = new QUERY(this)
   with (this.NAZDATA1)
      left = 30.0
      sql = 'select * from "C:data\nazdata.DBF"'
                active = true
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      height = 1.0
      left = 30.0
      top = 1.5
      width = 5.0
      value = 7
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 1.0
      left = 30.0
      top = 0.5
      width = 9.0
      alignVertical = 2        // Bottom
      alignHorizontal = 1        // Center
      fontSize = 8.0
      text = "No days"
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 11.0
      top = 14.0
      width = 17.0
      text = "Create Email File"
   endwith

   this.RADIOBUTTON1 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON1)
      height = 1.6364
      left = 3.0
      top = 1.5
      width = 2.0
      text = "Radiobutton1"
      fontSize = 8.0
      group = true
      value = true
   endwith

   this.RADIOBUTTON2 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON2)
      height = 0.9545
      left = 3.0
      top = 3.5
      width = 2.0
      text = "Radiobutton2"
      fontSize = 8.0
   endwith

   this.RADIOBUTTON3 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON3)
      height = 0.9545
      left = 3.0
      top = 5.5
      width = 2.0
      text = "Radiobutton3"
      fontSize = 8.0
   endwith

   this.RADIOBUTTON4 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON4)
      height = 0.9545
      left = 3.0
      top = 7.5
      width = 2.0
      text = "Radiobutton4"
      fontSize = 8.0
   endwith

   this.RADIOBUTTON5 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON5)
      height = 0.9545
      left = 3.0
      top = 9.5
      width = 2.0
      text = "Radiobutton5"
      fontSize = 8.0
   endwith

   this.RADIOBUTTON6 = new RADIOBUTTON(this)
   with (this.RADIOBUTTON6)
      height = 0.9545
      left = 3.0
      top = 11.5
      width = 2.0
      text = "Radiobutton6"
      fontSize = 8.0
   endwith

   this.TEXT2 = new TEXT(this)
   with (this.TEXT2)
      height = 1.9545
      left = 7.0
      top = 1.0
      width = 24.0
      fontSize = 8.0
      text = "New Customers with one order.  Usually 7 days but you can change that to if you like."
   endwith

   this.TEXT3 = new TEXT(this)
   with (this.TEXT3)
      height = 1.3182
      left = 7.0
      top = 3.5
      width = 22.0
      fontSize = 8.0
      text = "Customers with only 1 order over the past year."
   endwith

   this.TEXT4 = new TEXT(this)
   with (this.TEXT4)
      height = 1.3182
      left = 7.0
      top = 5.5
      width = 23.0
      fontSize = 8.0
      text = "Customers who have ordered within 90 days."
   endwith

   this.TEXT5 = new TEXT(this)
   with (this.TEXT5)
      height = 1.3182
      left = 7.0
      top = 7.5
      width = 23.0
      fontSize = 8.0
      text = "Customers who have ordered within 1 year."
   endwith

   this.TEXT6 = new TEXT(this)
   with (this.TEXT6)
      height = 1.3182
      left = 7.0
      top = 9.5
      width = 23.0
      fontSize = 8.0
      text = "Loyal Customers with over 10 orders within two years."
   endwith

   this.TEXT7 = new TEXT(this)
   with (this.TEXT7)
      height = 1.3182
      left = 7.0
      top = 11.5
      width = 23.0
      fontSize = 8.0
      text = "All Customers with Email addresses."
   endwith

   this.rowset = this.nazdata1.rowset
   function PUSHBUTTON1_onClick()
           backdate = form.entryfield1.value
                //order = form.entryfield2.value
                //go top
                if form.radiobutton1.value = true
                   if form.entryfield1.value = 7
                      set filter to date() < sdate + 7 .and. ord = 1 .and. .not. empty(email) .and. opt = .t.
                        else
                           set filter to date() < sdate + backdate .and. ord = 1 .and. .not. empty(email) .and. opt = .t.
                        endif
                endif
                if form.radiobutton2.value = true
         set filter to date() < sdate +365 .and. ord = 1 .and. .not.empty(email) .and. opt = .t.
                endif
                if form.radiobutton3.value = true
                   set filter to date() < sdate + 90 .and. .not.empty(email) .and. opt = .t.
                endif
                if form.radiobutton4.value = true
                   set filter to date() < sdate +365 .and. .not.empty(email) .and. opt = .t.
                endif
                if form.radiobutton5.value = true
                   set filter to date() < sdate + 730 .and. ord > 9 .and. .not.empty(email) .and. opt = .t.
                endif
                if form.radiobutton6.value = true
                   set filter to .not.empty(email)
                endif
                sele a
                delete all
                pack
                append blank
                replace email with "EMAIL"
           replace fname with "F_NAME"
                replace lname with "L_NAME"
                replace sdate with DATE()
                sele b
                go top
                do while .not. eof()
                   sele a
                   append blank
                   replace email with nazdata->email
                   replace fname with nazdata->fname
                        replace lname with nazdata->lname
                        replace sdate with nazdata->sdate
                        sele b
                   skip
                enddo
                sele a
           count to cnt
                cnt = cnt - 1
                copy to emailtext.txt delimited
                set exclusive off
                msgbox( 'Emailtext.txt is now populated with '+ cnt+ ' items.' )
                set safety on
                form.close()
      return

endclass