Alpha Video Training
Results 1 to 5 of 5

Thread: Syntax Help

  1. #1
    Member Scott Kurimski's Avatar
    Real Name
    Scott Kurimski
    Join Date
    Jul 2009
    Posts
    330

    Default Syntax Help

    In the example code below I simplified what tbl.eaannidate is equal to.

    tbl.eaannidate = date() just for this example so please don't get hung up on the value we are setting it to....the point is tbl.eaannidate will have a date in it.

    On this line...
    tbl.eaunpdanni = dbsum("T:\Public\Apps\EIM Track\novatime_time_vacation.dbf","_cempid",alltrim(tbl.eaempid),"if(npaycode = 3 .and. between(dworkdate,date()-30,date()),nreghr,0)")

    we need to replace this portion of the lookup expression date()-30 with the date that is in tbl.eaannidate

    Something like this...
    "if(npaycode = 3 .and. between(dworkdate,tbl.eaannidate,date()),nreghr,0)"

    The syntax on the line above produces the error on the attached file.

    I could use some assistance on the correct syntax.


    Here is the code...

    dim tbl as p
    tbl = table.open("T:\Public\Apps\EIM Track\empaccrual.dbf")
    tbl.fetch_first() 'Go to first record
    while .not. tbl.fetch_eof() ' Continue loop when there are records
    tbl.change_begin()
    tbl.eaannidate = date()
    tbl.eaunpdanni = dbsum("T:\Public\Apps\EIM Track\novatime_time_vacation.dbf","_cempid",alltrim(tbl.eaempid),"if(npaycode = 3 .and. between(dworkdate,date()-30,date()),nreghr,0)")
    tbl.change_end(.T.)
    tbl.fetch_next()
    end while
    tbl.close()
    Attached Images Attached Images

  2. #2
    Member
    Real Name
    Marco Gallardo
    Join Date
    Sep 2016
    Posts
    33

    Default Re: Syntax Help

    You could probably try to hack it in like this:

    Code:
    dim tbl as p
    dim varDate as D
    tbl = table.open("T:\Public\Apps\EIM Track\empaccrual.dbf")
    tbl.fetch_first() 'Go to first record
    while .not. tbl.fetch_eof() ' Continue loop when there are records
    tbl.change_begin()
    
    varDate = date() 'your unsimplified code here instead of "Date()"
    tbl.eaannidate = varDate 
    
    tbl.eaunpdanni = dbsum("T:\Public\Apps\EIM Track\novatime_time_vacation.dbf","_cempid",alltrim(tbl.eaempid),"if(npaycode = 3 .and. between(dworkdate,{" + varDate + "},date()),nreghr,0)")
    tbl.change_end(.T.)
    tbl.fetch_next()
    end while
    tbl.close()
    Last edited by mgallardo; 03-19-2019 at 05:35 PM. Reason: forgot curly braces

  3. #3
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: Syntax Help

    Try

    Code:
    tbl.eaunpdanni = eval("dbsum(\"T:\Public\Apps\EIM Track\novatime_time_vacation.dbf\",\"_cempid\",alltrim(tbl.eaempid),\"if(npaycode = 3 .and. between(dworkdate," + s_quote(tbl.eaannidate) + ",date()),nreghr,0)\")")
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  4. #4
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,253

    Default Re: Syntax Help

    The error you show claims there is no such field in the dbsum statement.
    Check closely to confirm that (tbl.eaempid) is the name of the field.

  5. #5
    Member Scott Kurimski's Avatar
    Real Name
    Scott Kurimski
    Join Date
    Jul 2009
    Posts
    330

    Default Re: Syntax Help

    Here is what I ended up using yesterday...
    "if(npaycode = 3 .and. between(dworkdate,{"+tbl.eaannidate+"},date()),nreghr,0)"

Similar Threads

  1. Pad Syntax
    By John Cunradi in forum Windows Desktop Applications
    Replies: 4
    Last Post: 08-13-2016, 11:15 AM
  2. pad syntax
    By John Cunradi in forum Windows Desktop Applications
    Replies: 6
    Last Post: 04-19-2016, 12:12 PM
  3. contains syntax
    By Mark Williams in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 01-19-2015, 12:35 PM
  4. Syntax
    By Portal 6 in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 11-18-2011, 11:25 AM
  5. syntax
    By Trixie dela Cena in forum Alpha Five Version 5
    Replies: 17
    Last Post: 04-16-2004, 06:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •