Alpha Video Training
Results 1 to 11 of 11

Thread: Problem with filter in Report.saveas()

  1. #1
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default Problem with filter in Report.saveas()

    Can anyone tell me whats wrong with the following
    Filter = "substr(key,1,len(alltrim(session.link)"+"=alltrim(session.link)"

    There is no way to test it as the session variable only exits in WAS and key is in the db.

    If session key contains "1234" I want all the records that start with "1234"

  2. #2
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,282

    Default

    Quote Originally Posted by robert swanson
    Can anyone tell me whats wrong with the following
    Filter = "substr(key,1,len(alltrim(session.link)"+"=alltrim(session.link)"

    There is no way to test it as the session variable only exits in WAS and key is in the db.

    If session key contains "1234" I want all the records that start with "1234"
    filter = "substr(key,1,len(alltrim("+quote(session.link)+")))=alltrim("+quote(session.link)+")"

  3. #3
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default

    Selwyn Did a direct substitution but still doesn't work. If I remove filter from the Report.SaveAs then the thing functions as it should by printing the whole thing so the problem is with the filter.

  4. #4
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default

    Since you said "If session key contains", it makes me suspicious - Is "key" a field name?

  5. #5
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,282

    Default

    Quote Originally Posted by robert swanson
    Selwyn Did a direct substitution but still doesn't work. If I remove filter from the Report.SaveAs then the thing functions as it should by printing the whole thing so the problem is with the filter.
    The filter expression I gave you is syntactically correct. Don't know why it does not work for you. You can easily verify that the filter is correct as follows.

    Open Alphasports.
    Go to the interactive window

    Type:

    Code:
    session.link = "graham"
    filter = "substr(lastname,1,len(alltrim("+quote(session.link)+")))=alltrim("+quote(session.link)+")"
    report.preview("Customer List",filter)
    You will notice that I changed the field from 'key' to 'lastname' because the customer table does not have a field called 'key'.

    But you could test this against your own report without having to make any changes to the filter expression.

  6. #6
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default

    Selwyn. The code does work but not with session variables. I deleted the session. and defined link as a constant. It works as long as the definition is in the component. I tried to both create link as a constant and = to session.link at the top of the A5w page that uses the component and in both cases link could not be found.

    So it looks like the session variables and page variables are not geting into the After Validate properties of the component which is a dialog That's used to set the print parameters

  7. #7
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,282

    Default

    I am NOT seeing this.

    I defined a Dialog with this as the AfterValidate event


    Code:
    if eval_valid("session.id") then 
    	echotext = session.id
    else
    	echoText = "session var not found"
    end if
    I then ran the dialog and pressed the Submit button.

    Initially, the echotext at the top of the dialog showed 'session var not found' (which is correct - the session var does not exist)

    Then I changed the URL in the browser to:

    Code:
    http://localhost/LivePreview/MyComponent_LivePreview.a5w?session.id=Robert
    The dialog displayed, and I clicked the Submit button. The browser now showed

    "Robert"

    as the echoText, proving that Session variables are visible in the AfterValidate event on a Dialog.

  8. #8
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default

    Selwyn Does echotext display variables in the browser. I did a search for it in Help but nothing came up. I've been looking for a way to display items in debugging because both html and Xbasic are new to me.

    I know that session.link is valid because I paste A5W_info(.f.) to the bottom of the page I'm working on . I'll try echotext and let you know.

    BTW I did think about using the interactive window after I went to bed.
    The trouble is that because everything I'm doing is in the Editor panel and when its maximized it covers everything up

  9. #9
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,282

    Default

    'echotext' should have been documented. it was an oversight.

    'echotext' is like a trace window that you can use to write out information while a dialog component's event hadlers are executing.

  10. #10
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default

    First all the above problems went away with the fianal release

    Now a new problem for the same report The grid contains radio buttons that select PDF HTML RTF TXT for format. And a set to select which report and how to deliver it.

    Every thing but HTML works both in live preveiw and through WAS.

    Code:
    dim filter as c 
    dim order as c
    dim link as c
    link=151
    if rprt="Family Tree" then
        report="gene"
        Order = "Key"
      else if rprt="Contact List" then
        report="contact"
        Order="name"
     end if
    filter = "substr(key,1,len(alltrim("+quote(link)+")))=alltrim("+QUOTE(link)+")"
    echotext= type
    if send_how ="To Browser" then
     Dim filename as c 
     filename = session.session_folder + chr(92) + "tempreport."+type
     filename = report.saveas(report,type,filter,order,filename,.f.)
     if file.exists(filename) 
      currentform.RedirectTarget = session.session_url + "tempreport."+type+"?" +  time("hms3")
     end if 
     else if send_how ="Email Attachment" then
     echotext="Email"
    end if
    Echotext show HTML when its chosen so type is correct according to the manual. The other three open up the correct editor/viewer for their type so I would assume that HTML should open a browser.

  11. #11
    Member
    Real Name
    Robert Swanson
    Join Date
    Sep 2005
    Location
    Burlington, ON. Canada
    Posts
    216

    Default

    Got the email portion working except for the HTML portion. In this case because send email is looking for the report file which is not being generated, I get an error.

Similar Threads

  1. report.saveas() run silent
    By Bill Parker in forum Alpha Five Version 6
    Replies: 3
    Last Post: 07-22-2005, 06:49 AM
  2. Report.Saveas Problem/Question
    By jwolfe11 in forum Alpha Five Version 5
    Replies: 1
    Last Post: 02-12-2004, 07:37 AM
  3. Report.SaveAs path?
    By roy in forum Alpha Five Version 5
    Replies: 2
    Last Post: 06-06-2003, 05:38 AM
  4. :report.saveas() problem
    By martinwcole in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-30-2003, 02:25 PM
  5. help with report.SaveAs
    By gkeramidas in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-15-2003, 07:43 PM

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
  •