cancel
Showing results for 
Search instead for 
Did you mean: 

Print Report to Text File

Former Member
0 Kudos

Hello All;

Is there any way to save Report type as a text file, instead of printing it ? I looked up almost every rule function but could'n find what I want. Only action step related with Report is Print Report step type so it is searching for printer but I really want to save it on the device.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

jason_latko
Advisor
Advisor
0 Kudos

Murat,

You cannot build your report string with a single transaction and rule.  This is a multi-step process.

First build the header part of the string in a transaction called "FormatReportHeader" that edits the Main Object property "StringWordWrap" (in my example) as you have done in the rule you sent to me, and apply that data.  You will need to change the "Target" property of your Transaction Steps to point at Main Object.

Next create a new sub-action in your report action that loops over your collection, like this:

Replace "ViewCategories" Action above with a new Action you will create called "FormatReportLoop"

FormatReportLoop has a Transaction Step followed by an Apply step.  Create a new Transaction called "FormatReportLoop" that edits the string property "StringWordWrap".  The loop above will execute once for every row in the collection, so we are building the string up one row at a time.  Use a rule similar to the one below to build your rows:

The rule always starts with the previous contents of "StringWordWrap" and appends a new row each time through.  My rule uses the "Name" property followed by the "ShortDesc" property.  The DummyWrap property is a string with 100 blank spaces in it.  The diff logic will format the line so that the ShortDesc column is always lined up properly by printing blank spaces to ensure that we always use 40 characters for "Name".  We finish each line with a NEWLINE.

Using the ATE, you should be able to "Inspect" your object data to see that your rules are correctly building your report before printing.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Thank you for your kind insterest Jason,after head scratching looong times, that's helped a lot.

Best Regards.

Murat

Answers (1)

Answers (1)

jason_latko
Advisor
Advisor
0 Kudos

Murat,

I don’t believe there is a simple solution to your problem.  When I was in the consulting group years ago, we needed to do something very similar to what you are trying to do.  It involved writing extra utilities in Embedded C and Embedded VB to handle printing from Agentry to a Blue-Tooth connected mobile printer on PPC.  The Embedded VB was used to take a text file we created from Agentry and send it to the Blue-Tooth COM port.  More easily:  You were asking about how you can write to a text file instead of printer on your PPC device?

First, forget trying to use the Print Report command.  Build the report yourself by storing the data in a single Main Object string property.  Create this by looping over your collection and adding the data to the string via a Transaction and an Update Rule on the property that keeps appending new lines to the existing data.  You should add a NEWLINE (String Function) after every line for formatting purposes.

Next, add a WindowsCommand step to your Action that will create the text file.  Notice that there is a File Mappings tab on this step.  Add a new mapping.  Point the Property to your property in the Main Object where you saved your report data.  Modify the filename as needed.

Now Agentry will create this text file and put it in the Temp directory on the device using the data in your string when the Action executes.  If you have a command line interpreter installed on the device, you can add a command line (on the Action Step Definition tab) to print your text file using your 3rd party Zebra program.  If not, you should be able to print the new text file outside of Agentry now using that Zebra program as well.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Dear Jason, Thank you for your help.