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

How to run reports from a Tabbed UI menu

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

    How to run reports from a Tabbed UI menu

    I am unsure of how to pass filter information from the user into the reports. I believe I wanted something similar to an xDialog, which obviously for desktop only, so created a Dialog2 that was not linked to a table and would just capture variables from there. The second part of the question and probably related is that I have written a multitude of different reports that I am unsure of the best practice on running from a Tabbed UI menu. My thoughts were to create an a5w page with buttons placed on it for each report that would have a Dialog2 with an embedded report.

    The Dialog2 I created works for capturing the filter data and then is passed though via arguments into the SQL Filter. This is fine if all parts of the Dialog2 are filled out by the user. e.g. The beginning and ending date, job name, employee name, etc. If the user wants to, for instance, have all employees and doesn't fill that field in the Dialog, the SQL statement gets and error because of the null argument. Basically, I need the dialog to work like the search function does in a grid. i.e. The search works regardless if all search criteria are filled in. If I can't figure this out, it appears that I must have a Dialog2 for each and every report and every report filter scenario. e.g. A Dialog2 for when searching on Date only, another Dialog2 when searching on Date and job name, another Dialog2 when searching on job name only........ This obviously is not practical and am sure I am missing something. I am sure there is another way, just don't know how to elegantly feed the filter data from the user to the report.

    I looked at the videos and discovered that "Power Search for Embedded Report" does what I need, but I apparently did not get that add-on. I wrote to Alpha to see if that can still be purchased for v11, but haven't heard back. Maybe the Alpha office is closed this week?

    Your direction is appreciated.

    #2
    Re: How to run reports from a Tabbed UI menu

    After many days of fighting and outstanding assistance from Simone, I have finally got it to work for my situation.

    The thread for Simone's assistance to me is:
    http://www.alphasoftware.com/alphafo...session_folder

    His solution was much more complicated and exotic than what I needed, but certainly put me over the top for getting my problem solved and much appreciated.

    My scenario was to have a Dialog 2, not bound to any table, serve as an entry form for users to enter filter information for many different reports. The filters would be for date range, job name, work order, employee, department, and time category. User could enter as little or as much filter criteria as needed. Overall desire was for user to be able to enter filter criteria once, and then run as many different reports as needed without reentering filter criteria each time for each report. The different reports are basically all the same with only difference being the grouping order and summation of the above filters e.g. one report was grouped by date, job, work order, employee, department, and time category while another report was grouped by job, work order, date, employee, department and time category. Code works well as the reports are generated in the session_folder which is automatically cleaned up after user logout.

    The dialog2 looks like:
    Screen Shot 2015-01-23 at 9.02.28 AM.png
    The buttons describe the report and when clicked run two ajax callback xbasic functions. One function opens a blank window and displays the working icon. The other button then runs xbasic to generate the report, save temporarily to session folder, and then display in a modal window as PDF.

    The first function "OpenReportWindow" code was the same for each button:

    Code:
    function OpenReportWindow as c (e as p)
    	dim js as c = ""
    	dim unique_id as c = "report" + time("hms3",now()) 'Only one report can be open at a time, so this should be a unique id for this user's current session
    	session.window_id = unique_id
    	
    	js = <<%jstxt%
    	window['{grid.componentName}_O_UNIQUE_ID'] = function(rowNum,rowId,objEle) {
    		if({grid.object}._embeddedMode) {
    			alert('Opening .a5w pages is not supported when the Component is running on the Desktop.');
    			return false;
    		}
    		
    	window['{Grid.ComponentName}_UNIQUE_ID'] = {grid.object}.createWindow('{grid.componentName}_WINDOW_UNIQUE_ID','modal-url-resizable',{
    		height: '5in',
    		width: '8in',
    		title: {
    			html: 'Window',
    			location: 'top'
    		},
    		disableMove: false,
    		theme: '{grid.style}',
    		body: {
    			content: {
    				type: 'url',
    				url: '__workingMessage.a5w'
    			}
    		},
    		onHide: function() { $(this.getWindowId('body')).src = '__workingMessage.a5w';}
    	}   );
    	window['{Grid.ComponentName}_UNIQUE_ID'].show();
    	$(window['{Grid.ComponentName}_UNIQUE_ID'].getWindowId('body')).src = '__workingMessage.a5w';
    	
    	}
    	
    	{grid.componentName}_O_UNIQUE_ID({grid.rownumber},'{grid.rowId}',this);
    	%jstxt%
    	
    	js = strtran(js, "UNIQUE_ID", unique_id)
    	
    	OpenReportWindow = js
    
    end function
    The second function "ReportxPrint" was specific to each report, but essentially the same by only changing the report name and removing sql arguments if not needed for the report.
    Code:
    function Report1Print as c (e as p)
    dim filter as c = ""
    dim order as c = ""
    dim rptargs as sql::Arguments
    dim rptoptions as p
    dim session.rptbegdate as c = e.datasubmitted.rptdatebeg
    dim session.rptenddate as c = e.datasubmitted.rptdateend
    vcontactid = convert_type(e.datasubmitted.rptcontactid, "n")
    vworkorder = convert_type(e.datasubmitted.rptworkorderid, "n")
    vempid = convert_type(e.datasubmitted.rptempid, "n")
    vdeptid = convert_type(e.datasubmitted.rptdeptid, "n")
    vtimecateg = convert_type(e.datasubmitted.rpttimecateg, "n")
    
    rptargs.add("vdatebeg", "{" + e.datasubmitted.rptdatebeg + "}")
    rptargs.add("vdateend", "{" + e.datasubmitted.rptdateend + "}")
    rptoptions.filter = "srchin BETWEEN :vdatebeg AND :vdateend"
    if vcontactid > 0 
    	rptargs.add("contactid",vcontactid)
    	rptoptions.filter = rptoptions.filter + " AND contactid = :contactid"
    end if
    if vworkorder > 0 
    	rptargs.add("workorderid",vworkorder)
    	rptoptions.filter = rptoptions.filter + " AND workorderid = :workorderid"
    end if
    if vempid > 0 
    	rptargs.add("empid",vempid)
    	rptoptions.filter = rptoptions.filter + " AND empid = :empid"
    end if
    if vdeptid > 0 
    	rptargs.add("deptid",vdeptid)
    	rptoptions.filter = rptoptions.filter + " AND deptid = :deptid"
    end if
    if vtimecateg > 0 
    	rptargs.add("categoryid",vtimecateg)
    	rptoptions.filter = rptoptions.filter + " AND categoryid = :categoryid"
    end if
    Dim filename as c = Request.GetRequestTempFileName("pdf")
    filename = report.saveas("YourReportNameHere","pdf",filter,order,filename,.f.,.f., rptargs, rptoptions)
    if file.exists(filename)
        Session.SaveDataAsFile("tempreport.pdf",file.to_blob(filename))
    	Report1Print = "$(window['{Grid.ComponentName}_" + session.window_id + "'].getWindowId('body')).src = '" + js_escape(Session.FormatFileDataURL("tempreport.pdf")) + "';"
    end if
    end function
    For whatever it is worth....there it is. I am certainly not a strong programmer and the code needs to be vastly improved for error trapping and resolution and probably several other bad habits. My code assumes everything will just go swimmingly. Will also be working on a button that will give the option of opening report as a PDF or download as EXCEL......but that is another day.

    Good luck and many thanks to Simone!

    Comment

    Working...
    X