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

HTML Report showing content from xbasic functions

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

    HTML Report showing content from xbasic functions

    Hi all,

    Does anyone have any experience with coding report content from xbasic, and then simple showing it in one static html field in the report. Can reports still be styles fairly easy?

    My problem: I have several reports that I combine into one pdf file, this also works . But I find it a bit difficult to align and get styling, borders, colors to work properly with both free-form or table-form reports in the system.
    I have tried using linked reports to have several groups and detail sections this way, but borders and colors don't work correctly when they come from linked reports.

    So now I'm actually thinking to code everything in xbasic, and combine it in one variable and having this variable in a static html field on the report. I have already done some of the work with some of my reports, and they are build into html tables. This seems to work ok. But I need some help on how to apply css to the report then. I would properly put everything in several tables and then it would be nice it I could apply and change css, this way I could have several designs for the reports.
    Kind regards
    David H-S

    Using: Alpha Anywhere V12

    #2
    Re: HTML Report showing content from xbasic functions

    David, I think I just might have what you are looking for.
    Generating PDF Reports for me was a cpu killer so I came up with this.
    It combines X-Basic with HTML to create the report and save it into a "../reports" directory.
    Afterward, my code will send an email to the user that includes a web link back to the finished report.

    I use it as a grid cell freeform template:
    freeform.gif

    Code:
    '===============================================================
    '					CRIMINAL REPORT
    '===============================================================
    function CriminalReport as c(e as p)
    
    '== query tables and output into a propert array
    sqlStatement = <<%sql%
    SELECT applicants.APPLICANTID,applicants.SSN, applicants.DOB, applicants.FIRST, applicants.LAST, applicants.ADDRESS1, applicants.CITY, applicants.STATE, applicants.ZIP, applicants.HOMEPHONE, applicants.CELLPHONE, applicants.EMAIL, criminalbackground.LOCATION, criminalbackground.OFFENSEID, criminalbackground.OFFENSEDATE, criminalbackground.CONSEQUENCES, criminalbackground.DETAILS, dbcategories_criminalbackground.CATEGORY
    FROM applicants applicants
    INNER JOIN (criminalbackground criminalbackground
    INNER JOIN dbcategories_criminalbackground dbcategories_criminalbackground
    ON  criminalbackground.OFFENSEID = dbcategories_criminalbackground.OFFENSEID )
    ON  applicants.APPLICANTID = criminalbackground.APPLICANTID
    WHERE applicants.APPLICANTID = {clientid}
    %sql%
    sqlStatement = evaluate_string(sqlStatement)
    cn.topropertyarray(sqlStatement,arr_data)
    cn.Close()
    
    '== populate variables from first record
    dim reportDate as d = DATE()
    dim firstname as c = ut(arr_data[1].FIRST)
    dim lastname as c = ut(arr_data[1].LAST)
    dim address as c = arr_data[1].ADDRESS1
    dim city as c = arr_data[1].CITY
    dim state as c = arr_data[1].STATE
    dim zip as c = arr_data[1].ZIP
    dim homephone as c = arr_data[1].HOMEPHONE
    dim cellphone as c = arr_data[1].CELLPHONE 
    dim email as c = arr_data[1].EMAIL
    dim offenseDate as T = arr_data[1].OFFENSEDATE
    dim county as c = arr_data[1].LOCATION
    dim offense as c = arr_data[1].CATEGORY
    dim comment as c = arr_data[1].DETAILS
    dim outcome as c = arr_data[1].CONSEQUENCES
    dim dob as d = arr_data[1].DOB
    dim age1 as n = age(arr_data[1].DOB)
    dim ssn as c = arr_data[1].SSN
    
    '== set up the html
    reportHtml = <<%longstring%
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
    <meta name="Author" content="ModernConceptuals.com />
    <link href="https://ablejobs.us/images/favicon.ico" rel="Shortcut Icon" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css" href="https://ablejobs.us/pro_dropdown_3.css" />
    <title>Criminal Background Check</title>
    </head>
    
    <body bgcolor="#EDEDF0">
    	<p align="center"><img border="0" src="https://ablejobs.us/images/globalscreenlogo.png"></p>
    	<div align="center">
    	<table border="0" width="644" height="651" style="border: 3px ridge #000000; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px" >
    		<tr>
    			<td height="25" width="632" align="left" valign="top" colspan="2">
    				<span class="preload1"></span>
    				<span class="preload2"></span>
    				<ul id="nav">
    					<li class="top"><a href="https://ablejobs.us/emp-home.a5w" id="home" class="top_link"><span>Home</span></a></li>
    					<li class="top"><a href="#nogo1" id="home" class="top_link"><span>Print</span></a><a onClick="window.print();return false" href="whatever.htm"></li>
    				</ul>
    			</td>
    		<tr>
    			<td height="54" width="100%" valign="top" colspan="2" align="center">
    				<p align="center">
    				<font face="Arial" size="3" color="#800000">Criminal Background Check<br>
    				{reportDate}<br>
    				</font>
    				</p>
    			</td>		
    		</tr>
    		<tr>
    			<td height="94" width="340" valign="top">
    				<font face="Arial" size="3" >
    				Name:{firstname} {lastname}<br>
    				DOB: {dob} Age: {age1}<br>
    				SSN: {ssn}<br>
    				Address: {address} {city}, {state} {zip}<br><br>
    				Email:{email}<br>
    			</td>
    			<td height="94" width="288" valign="top">
    				Phone:{homephone}<br>
    				Mobile:{cellphone}<br>
    			</td>
    		</tr>
    		<!-- DETAIL -->
    		<tr>
    			<td height="134" width="100%" valign="top" colspan="2">
    				<img border="0" src="http://ablejobs.us/images/hbar1.jpg" width="100%" height="3"><br>
    				Date:{offenseDate}<br>
    				Offense:{offense}<br>
    				County:{county}<br>
    				Outcome: {outcome}<br>
    				Notes:{comment}<br>
    				<img border="0" src="http://ablejobs.us/images/hbar1.jpg" width="100%" height="3"><br>
    			</td>
    		</tr>
    		<!-- END DETAIL -->
    %longstring% 
    content = evaluate_string(reportHtml)
     
    x=0 
    
    '== after first row has populated, loop through the remainder
    '== note that DETAIL is used again
    for x=2 to arr_data.size() 
    	offenseDate = arr_data[x].OFFENSEDATE 
    	county = arr_data[x].LOCATION 
    	offense = arr_data[x].CATEGORY 
    	comment = arr_data[x].DETAILS 
    	outcome = arr_data[x].CONSEQUENCES 
    	reportHtml = <<%longstring%
    			<!-- DETAIL -->
    			<tr>
    				<td height="134" width="100%" valign="top" colspan="2">
    					<img border="0" src="http://ablejobs.us/images/hbar1.jpg" width="100%" height="3"><br>
    					Date:{offenseDate}<br>
    					Offense:{offense}<br>
    					County:{county}<br>
    					Outcome: {outcome}<br>
    					Notes:{comment}<br>
    					<img border="0" src="http://ablejobs.us/images/hbar1.jpg" width="100%" height="3"><br>
    				</td>
    			</tr>
    			<!-- END DETAIL -->
    	%longstring%
    	reportHtml = evaluate_string(reportHtml)
    	*concat(content,reportHtml)
    next
    
    '== add the page footer
    reportHtml = <<%longstring%
    		<!-- REPORT FOOTER -->
    		<tr>
    			<td height="26" width="100%" valign="top" colspan="2">
    				<pre>{paste}</pre>
    				</font>
    			</td>
    		</tr>
    		<tr>
    			<td height="197" width="100%" valign="top" colspan="2" align="center">
    				<p align="left">
    				<font face="Arial" color="#454545" size="1">*Global Job Screening assembles criminal background information from a variety of sources containing 
    				information from public record databases. These sources are not maintained by Global Job Screening and may be fallible, both human and otherwise. 
    				Although Global Job Screening does it's best to assure the accuracy of the information given, it can not assume responsibility for accuracy, validity, 
    				or completeness of any of the information obtained from third party sources.<br>
    				** It is Global Job Screening intention that all information contained in this report be used by the recipient in a manner governed by local, state, and 
    				federal law especially in regards to Equal Opportunity Employment and privacy matters. Global Job Screening does not assume responsibility for the misuse 
    				of information by the recipient.</font></p>
    				<p align="center">
    				<font size="1" face="Arial" color="#454545">&copy; 2009 JobsAtAble<br>
    				Site Design by: <a href="mailto:[email protected]">ModernConceptuals</a></font></p>
    			</td>
    		</tr>
    		<!-- REPORT FOOTER -->
    	</table>
    </div>
    </body>
    </html>
    %longstring%
    reportHtml = evaluate_string(reportHtml)
    *concat(content,reportHtml)
    
    '== email report? I store it into a session variable
    '== for easy access later on
    if email_report = 1 then
    	session.report = content
    	sleep(3)
    else	
    	'== user wants to see it now
    	save_to_file(content,vfilePath)
    	'== here I redirect him to the saved file
    	CriminalReport = "window.location.assign('http://TheFinishedReport_URL');"
    end if
    
    end function
    Last edited by mvaughn; 03-22-2014, 10:57 PM.
    Rapid Development, Training, Support
    http://data2web.network
    903-740-2549

    Comment


      #3
      Re: HTML Report showing content from xbasic functions

      David,

      I create some reports that way.

      I use a button on a UX form to do a callback. In the callback I create the html in a UserDefinedFunction and assign it to a session variable, such as

      Session.MYREPORT = my_html_builder(input parameters like "JobNumber")

      Then in the report I create a calculated field using the printHTML() function, like

      My_calc_Field = printHTML(Session.MYREPORT)

      and put the calculated field on the report.

      Here's a report that contains 8 such calculated fields:

      So, do your css selection in the UDF.
      Attached Files
      Last edited by Pat Bremkamp; 03-23-2014, 08:55 AM.
      Pat Bremkamp
      MindKicks Consulting

      Comment


        #4
        Re: HTML Report showing content from xbasic functions

        Pat that looks like on serious amount of html. Have you tried putting fusion charts into a report?
        Chad Brown

        Comment


          #5
          Re: HTML Report showing content from xbasic functions

          Hi all,

          Thank you all for your advises. I didn't think about the function Michael refers to, where it is possible to create a html file and save it on the server.

          I have been trying almost the same way that Pat refers to, created a class where I use the a5_mergedataintotemplate function to generate my html table.
          Then in report I dim a variable as the class, I do this in the event OnPrintInit. I can then put my data in local variables and get them out by printhtml() in a static html field.
          My problem with this way, is that some css get lost. And most important, my report makes page breaks in pictures and other places where I don't want it to break. (A normal report is about 20-30 pages in pdf.)

          Now I'm back to normal reports, when I want to generate a report I do this with ajax call back. I then create the report in xbasic, it is done by generating 5-6 separate reports and then combine them at the end. At the moment it works ok, but I spend a lot of time making the reports. So I'm seriously considering to do it all in html, it would maybe be easier to save everything in a html file. Then actually I could concatenate header data before file data (html file could hold only <body> tag), this way css could be changed without having to generate a new "report".

          BTW - Pat the attached report looks very nice, is this all done in html (printhtml)? You also wrote "So, do your css selection in the UDF." what do you mean by UDF?
          Kind regards
          David H-S

          Using: Alpha Anywhere V12

          Comment


            #6
            Re: HTML Report showing content from xbasic functions

            UDF is user designed function. Just go to the code tab of the control panel and create a function. Then compile your functions into an aex file and publish it.
            Pat Bremkamp
            MindKicks Consulting

            Comment

            Working...
            X