Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Help with displaying a report??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with displaying a report??

    Folks,

    I am still stuck on the seemingly simple task displaying a pdf report based on records selected in a grid.

    My setup is this.

    I have a data table named �items� which contains items in inventory. The table contains a unique auto number field called �Item_Id�

    I have created a Report called �itemsrpt� which is formatted to display the items that are picked in a grid control.

    I have a web grid component that is used display the Item_Id in a freeform layout with a checkbox as {Item_Id} "input type="checkbox" name="Item_Id[]" value="{Item_Id}"
    Which passes the Item_Id value if the box is checked.

    The A5W page containing the grid component is �SelectItem.a5w� and contains two command buttons within the same table as the grid control that are pressed by the user to Print Order or Clear Selections. The source for this page is the following along with the javaS:



    "head"
    "script language="JavaScript""
    function printLabels()
    {
    var toolbar = 'no';
    var menubar = 'no';
    var location = 'no';
    var statusbar = 'no';
    var resizable = 'yes';
    var width = 750;
    var height = 500;
    window.open('PrintLabel.a5w?'+determineItemIdsFromCheckboxes(),'LabelsWindow','location='+location+',menubar='+menubar+',toolbar='+toolbar+',status='+statusbar+',resizable='+resizable+',width='+width+',height='+height)
    }

    function determineSelectedRadioButton()
    {
    var retVal = '';
    for (i = 0; i " document.SelectItem.Item_Id.length; i++)
    {
    if (document.SelectItem.Item_Id[i].checked)
    {
    retVal = document.SelectItem.Item_Id[i].value;
    break;
    }
    }
    return retVal;
    }
    "/script language="JavaScript""
    "%a5
    Delete tmpl_ItemSelection
    DIM tmpl_ItemSelection as P
    tmpl_ItemSelection = a5w_load_component("ItemSelection")
    'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
    'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
    'Each component on a page must have a unique alias (componentName property).
    with tmpl_ItemSelection
    componentName = "ItemSelection"
    end with
    '=======================================compute the HTML for the Component=======================================
    delete x_ItemSelection
    dim x_ItemSelection as p
    tmpl_ItemSelection.request = request
    tmpl_ItemSelection.session = session
    tmpl_ItemSelection.response = response
    tmpl_ItemSelection.serversetting = serversetting
    tmpl_ItemSelection.PageVariables = local_variables()
    x_ItemSelection = a5w_run_Component(tmpl_ItemSelection)
    '=============================================================================================================
    if x_ItemSelection.RedirectURL "" "" then
    response.redirect(x_ItemSelection.redirectURL)
    end
    end if
    ?x_ItemSelection.Output.Head.JavaScript
    ?x_ItemSelection.Output.Head.CSS_Link
    %"
    "!--Alpha Five Temporary Code Start - Will be automatically removed when page is published --"
    "!--CSS for tmpl_ItemSelection --"
    "link rel="stylesheet" type="text/css" href="file:///C:\Program Files\A5V6/css/Corporate/style.css""
    "!--Alpha Five Temporary Code End --"

    "meta name="generator" content="Alpha Five HTML Editor""
    "title""/title"
    "/head"
    "body class="CorporatePageBODY" "

    "p""br"
    "table"

    "tr"
    "td""%a5 ?x_ItemSelection.Output.Body.Grid_Echo %""/td""/tr"
    "tr"
    "td""%a5 ?x_ItemSelection.Output.Body.UpdateErrors %""/td""/tr"
    "tr"
    "td""%a5 ?x_ItemSelection.Output.Body.Search_HTML %""/td""/tr"
    "tr"
    "form name=SelectItem method=post action="printlabel.a5w""
    "td""%a5 ?x_ItemSelection.Output.Body.Grid_HTML %"

    "input class="CorporateButton" type=submit value="Print Order"" 
    "input class="CorporateButton" type=reset value="Clear Selections""
    "/form""/td"
    "/tr"
    "tr"
    "td""%a5 ?x_ItemSelection.Output.Body.DetailView_HTML %""/td""/tr""/table""/p""/form"
    "/body"


    ***********************************************************

    The �PrintLabel.a5w� page referenced in the javaS above contains source only.

    "%a5

    if eval_valid("Item_id")
    if Item_id[1] = ""
    goto ItemidNotSpecified
    end if


    dim filter as c
    dim order as c


    filter = Item_id.dump()
    filter = *for_each(x,"Item_id = " + quote(x),filter)
    filter = strtran(alltrim(filter), crlf()," .&. ")
    order = ""

    dim filename as c

    filename = session.session_folder + chr(92) + "templabels.pdf"
    filename = Report.saveas("Itemsrpt@[PathAlias.ADB_Path]\Items.dbf","PDF",filter,order,filename,.f.)

    if file.exists(filename)
    response.redirect(session.session_url + "templabels.pdf?" + time("hms3"))
    end
    end if
    else
    ItemidNotSpecified:
    end if
    %"


    "head"
    "meta name="generator" content="Alpha Five HTML Editor""
    "title""/title"
    "/head"
    "body"
    "p"Error: You must call page with a query string that specifies the Item ID(s)."br"
    For example: "%a5 ? request.script_name %"?item_id[]=000001&item_id[]=000013"/p"

    "p" "/p"
    "/body"

    **********************************************************

    The error I get when trying to display a report after selecting any items (in this case items 68 and 69) is:

    500 Internal Server Error
    Script Error
    Error:Invalid report filter expression: 'Item_id = "68" .&. Item_id = "69"'.
    ________________________________________
    Alpha Five/6.0 Build/1600-2057 at DNMH211 Port 81


    Most of this comes from the examples in the Alpha Help files but I am not working with it correctly obviously. Can anyone see the problem with my filter expression because I can�t.

    Thanks for you time..

    Chuck

    #2
    RE: Help with displaying a report??

    Could this be because the grid in the web page is sending a character representing item_Id "68" or "69" that cannot be resolved to the table because the table item_Id field is numeric?

    If so, how can I resolve this without changing that field in the table? I need this to be numeric so I can use the auto number feature as records are added. This is the only sure way to keep a unique field for each record.


    CHuck

    Comment


      #3
      RE: Help with displaying a report??

      "I need this to be numeric so I can use the auto number feature as records are added." - If you mean auto-increment then it need not be number. Auto-increment fields can be character fields containing characters and digits.

      Excuse me if I misunderstand your question. Here's the pertinent documentation of auto-increment...


      Auto-Increment Fields

      When you define a character, numeric, or date field with an auto-Increment rule, an incremented value is automatically filled in when you create a new record, which you can accept or overwrite. If you overwrite the default value, successive records are incremented from the value you enter.

      Auto-Increment fields are useful for assigning unique identification numbers for invoices, parts, products, and customers. By default, character fields are incremented using number characters (like "0001", "0002"). If you do not enter a value for the first record, Alpha Five automatically starts a character field at "1".

      When a field is incremented, it follows the previous record's field conventions. For example, the value "A1" will be "A2" in the following field, then "A3" and so on. Additionally, you can increment both letter and number field values. The auto-increment field rule takes into account deleted records.

      There can be only one.

      Comment


        #4
        RE: Help with displaying a report??

        Then again I don't see how the filter could work as

        'Item_id = "68" .&. Item_id = "69"'

        Item_id cannot be both "68" and "69" .

        Need an .or. somewhere.
        There can be only one.

        Comment


          #5
          RE: Help with displaying a report??

          Thanks for the info Stan. That is very helpful to me in the future. I did not mean to impose the limitation on Alpha 5. It is more a limitation of my own with respect to the volume of data already in the table.

          Unfortunately it still does not help me with the original report problem.

          Cheers,

          Chuck

          Comment


            #6
            RE: Help with displaying a report??

            Same Error with And or Or used in the filter. The posted code is the result of my tampering and forgetting to put back in original form.

            Comment


              #7
              RE: Help with displaying a report??

              But doe the filter string not make more since with And because I want the report to display this item And that Item And Item(n) not this one Or that one.

              These semantics are killing me!

              Chuck

              Comment


                #8
                RE: Help with displaying a report??

                The filter is evaluated for all of the records in the table to decide if it should be included or not, one at a time. So Alpha looks at the first record and asks, for this record is the item_id equal to "68" and is it also equal to "69". Answers no and checks the next record, etc.

                I'm a complete WAS rookie but try



                filter = strtran(alltrim(filter), crlf()," .or. ")

                and if that doesn't work, which I don't think it will change these two lines as indicated.

                filter = *for_each(x,"Item_id = " + x,filter)
                filter = strtran(alltrim(filter), crlf()," .or. ")
                There can be only one.

                Comment


                  #9
                  RE: Help with displaying a report??

                  I understand what you are saying but .or. does not fix the primary filter problem though it prevents one should i get past this. Also removing Quote() did not result in any difference the error was exactly the same.

                  500 Internal Server Error
                  Script Error
                  Error:Invalid report filter expression: 'Item_id = "68" .or. Item_id = "69"'.

                  Thanks for your time on this. The code is taken from the Supplies Web_Applications_Demo. It works there but not in my little implementation.

                  hummmm!

                  Comment


                    #10
                    RE: Help with displaying a report??

                    I just used the filter genie in the report to get an idea of what it is expecting from the filter. It looks like my filter express in needs to be in the format Item_id = {19} as opposed to Item_id = "19".

                    Any idea how I get the expression to use that format??

                    Comment


                      #11
                      RE: Help with displaying a report??

                      Chuck,
                      I think your problem comes from the value in the table being a number, but the value in the grid is character (as I understand it, everything shown is a character), so you may need to convert back to numeric values in order to apply the filter. Do a search on convert type for more info.
                      Pat
                      Pat Bremkamp
                      MindKicks Consulting

                      Comment


                        #12
                        RE: Help with displaying a report??

                        To test this I did the opposite of what you suggest but should have had the same effect if it is a type problem. I changed the table field Item_Id to character instead of Numeric. Still got the same Error though.

                        Comment


                          #13
                          RE: Help with displaying a report??

                          Ok Ok I will be damned. Changing the filter from this:

                          filter = *for_each(x,"Item_id = " + quote(x),filter)

                          to this:

                          filter = *for_each(x,"Item_id = " + val(x),filter)

                          Works

                          Problem solved!

                          So it would seem that this was a type problem after all. What I do not understand is how the first filter expression works in the demo. When I changed my Item_id field to type Character in the table the same error occured. Well at least it works for my table the way I intended.

                          Thanks for all the help guys. It is so much better to get to bounce this stuff off others.

                          Cheers,

                          CHuck

                          Comment


                            #14
                            RE: Help with displaying a report??

                            filter = *for_each(x,"Item_id = {" + x + "}",filter)

                            filter = strtran(alltrim(filter), crlf()," .or. ")
                            ? filter
                            = "Item_id = {68} .or. Item_id = {69}"
                            There can be only one.

                            Comment


                              #15
                              RE: Help with displaying a report??

                              This worked too.

                              filter = *for_each(x,"Item_id = " + val(x),filter)

                              Thanks Stan..

                              See my last post in this thred...

                              Comment

                              Working...
                              X