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

Running a desktop report from the web

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

    Running a desktop report from the web

    I have a desktop application to which I'm adding a UX interface. Specifically, a customer can log in, update a couple of fields and then run a report.

    The Application is LAN based and is using dbf tables. The report needs to be filtered to yield the correct results. On the desktop, I wrote a script that would set a number of global variables. There are a number of lookups to tables and a number of calculated fields on the report.

    Here's some of the xbasic code needed to generate the report.

    Code:
    IF vRptDays = "" THEN
    	vRptDays = convert_type(a5_eval_expression("=alltrim(lookup(\"defaults\",\"Transno =\" + s_quote(vcTransno),\"Days\"))"),"C")
    END IF
    
    IF vRptHours = "" THEN
    	vRptHours = convert_type(a5_eval_expression("=alltrim(lookup(\"defaults\",\"Transno =\" + s_quote(vcTransno),\"Hours\"))"),"C")
    END IF
    
    IF vRptCycles = "" THEN
    	vRptCycles = convert_type(a5_eval_expression("=alltrim(lookup(\"defaults\",\"Transno =\" + s_quote(vcTransno),\"Cycles\"))"),"C")
    END IF
    
    vDays = var->vRptDays
    vHours = var->vRptHours
    vCycles = var->vRptCycles
    
    vRptDays = vDays
    vRptHours = vHours
    vRptCycles = vCycles
    'vRptLdgs = vLdgs
    
    query1 = "Maint_Work->transno=Var->vcTransno.AND.Maint_Work->Recurring=.T..AND."
    query2 = ".NOT.isblank('Date_Due').AND.(Date_Due-now()<=val(Var->vRptDays))"
    query3 = "Hour_Int<>0.AND.(val(Var->vRptHours)+lookup('defaults','Transno ='+s_quote(vcTransno),'AFTT')>=Hours_Due)"
    query4 = "Cycle_Int<>0.AND.(val(Var->vRptCycles)+lookup('defaults','Transno ='+s_quote(vcTransno),'Lecyc')>=Cycles_Due)"
    query5 = "Cycle_Int<>0.AND.(val(Var->vRptCycles)+lookup('defaults','Transno ='+s_quote(vcTransno),'Engcyc')>=Cycles_Due)"
    query6 = "Cycle_Int<>0.AND.(val(Var->vRptCycles)+lookup('defaults','Transno ='+s_quote(vcTransno),'Recyc')>=Cycles_Due)"
    '' query7 is used for aux hobbs.  not included at this time
    query7 = "auxhobbsInt<>0.AND.val(Var->vRptHours)+AuxHobbscur>=AuxHobbsDue"
    query.filter = query1+query2+".OR."+query1+query3+".OR."+query1+query4+".OR."+query1+query5+".OR."+query1+query6+".OR."+query1+query7
    I have had some success running the report from the web, but most of the calculated fields error out. Is it possible to run an xbasic script from the web? Is it possible to set global variables for reports to use?

    What I want is on the left and what I get is on the right.
    Attached Files
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: Running a desktop report from the web

    Bump
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    Comment


      #3
      Re: Running a desktop report from the web

      I have finally gotten around to tackle this problem again.

      I have created a UX component.
      I have a data control, list which has all the fields I need for my report.
      The list returns 15 fields.
      Some of the fields would be changeable to filter the report.

      It looks like I can create session variables from the data in the fields of the selected list row.
      I would need a session variable for each field.

      I then can reference the session variables as calculated fields in my report.

      I can't figure out how to create the session variables.

      If the user were to change the value in some of the fields, the session variable would
      need to be updated after the submit button was pressed.

      TIA,

      Ron
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        Re: Running a desktop report from the web

        Ron,

        There are different methods that can be used to set the report variables. If you want to pass session variables, you need to set them using server side xbasic. However, using arguments is a relatively easy method.



        In the report:

        1. Create arguments (Edit menu) for each of the variables to be used and be sure the scope is appropriate (1.e. character, number) (ex.argVar1, argVar2 ...)

        2. Under the 'on print initiation' event, dim and set the values for each argument as follows:


        DIM SHARED var1 as c
        var1 = A5_GetArgumentValue("argVar1")
        DIM SHARED var2 as n
        var1 = A5_GetArgumentValue("argVar2")
        ...

        3. Under the variables menu, Define session variables, setting defaults:

        var1=""
        Var2=0

        ...

        4. Save the report

        In the web UX:

        1. Create a control for each variable to be set

        2. Create a button to call the report.

        3. Bind the arguments to each control.

        Hope this helps.

        John

        Comment


          #5
          Re: Running a desktop report from the web

          John,

          Thank you so much for your step by step response. Excellent!
          I tested just two fields but this is what I was looking for.

          Sincerely,

          Ron
          Alpha 5 Version 11
          AA Build 2999, Build 4269, Current Build
          DBF's and MySql
          Desktop, Web on the Desktop and WEB

          Ron Anusiewicz

          Comment


            #6
            Re: Running a desktop report from the web

            Ron,
            You're welcome. Also, to respond more directly to your original question, her is how to set session variables in the report context.

            Create an xbasic function with 'e as p' for the argument. Set the session variables to the controls by way of the data submitted element. For example:

            function setVar as c (e as p)

            session.var1 = e.datasubmitted.control1

            etc.

            end function

            In the action javascript that is attached to the button, insert an ajax callback action before the print report action.
            In the line for the xbasic function type in the function name without the argument or parentheses (i.e. 'setVar')

            The session.variable can be addressed directly by the report. However, in the past I ran into some issues with the variables not setting correctly because AJAX is asynchronous. As such, the report may begin to run before all of the variables have been set. You can add some delays and such but the argument method I think is more foolproof.

            John

            Comment


              #7
              Re: Running a desktop report from the web

              John,

              Thanks again. I've copied your lessons and have saved them for future reference.

              I'm still working on the report and I'm making a lot of headway. When running the report in working Preview,
              the report runs alright. However; when trying to run the report in live preview, I get an Alpha error message.

              Any ideas on what could be causing this error? I suspect it has something to do with the arguments, but I
              really do not know where to begin looking. I've checked everything I have and it all looks good.

              Thanks again,

              Ron
              Attached Files
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                Re: Running a desktop report from the web

                Ron,

                This error usually means that an argument is null. It could be that one of the controls was not populated or an argument was not bound to a control. If you check this and still get the error, try debugging it. Edit the button calling the report. Click the convert to 'server side xbasic'. Then enter a debug(1) in the 1st line. Save and run it. Check the values of the arguments and see if any errors pop up. Also check your page security and report security settings to be sure they are allowed.

                John

                John

                Comment


                  #9
                  Re: Running a desktop report from the web

                  Thanks again John. You were right on.

                  This error usually means that an argument is null.
                  Alpha 5 Version 11
                  AA Build 2999, Build 4269, Current Build
                  DBF's and MySql
                  Desktop, Web on the Desktop and WEB

                  Ron Anusiewicz

                  Comment

                  Working...
                  X