We are currently sending estimates to our sales reps from filemaker, all our reps have blackberries. Capturing and formatting the data was a pain in Filemaker. As I rebuild the solution in Servoy, I want to add this fuctionality.
Now that I have sucessfully created / emailed PDF’s via the mail plugin, I want embed estimate info into the body of an email.
These estimates will be very basic:
order info,account info, a few dates, Line Item Detail, and a few totals.
I know this can be much more robust using html , etc. but I just wanted to keep it simple. Should I try to capture all this info into a global and format, or merge a few globals into the message body.
I was just looking for a point in the right direction.
I guess my main question is regarding the lineitems. In filemaker I had to loop through the line items and paste them into a global. I figured there was an easier way to capture them in Servoy.
In Servoy you also loop though the records but you can do all this in code. So no screen updates as with FileMaker.
Also you don’t have to use globals when you want to produce the HTML content only 1 time. You simply use a local variable in a method and append new data to it like this:
ok, thanks thats the route I was thinking about, but was going to convert a dataset to an array, but looks like it will be easier to format directly as html using the JSDataSet functions
I am having a problem, with capturing my dataset. I wentr into the query analyzer to run my query, then pasted my query into the Servoy Method.
I just wanted to see the data in simple format before I started formating into html.
I am getting the following error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near ‘order_id’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near ‘order_id’. is not a function.
Here is my method:
//Get a dataset based on query
var maxReturnedRows = 30;
var query =
“SELECT Item_Condition, Item_Description, Item_Total”+
“FROM orderlineitems”+
"WHERE order_id = order_number AND Item_Description LIKE ‘%’ ";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query,null, maxReturnedRows);
//assuming the variable dataset contains a dataset, you can create csv or tab delimited results
var tab = dataset.getAsText(‘\t’,‘\n’,‘"’,true)
//Get a dataset based on query
var maxReturnedRows = 30;
var query =
“SELECT Item_Condition, Item_Description, Item_Total”+’ '+
“FROM OrderLineItems”+ ’ ‘+
“WHERE Order_ID =”+’ '+ order_number;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query,null, maxReturnedRows);
//assuming the variable dataset contains a dataset
var dataHtml = dataset.getAsHTML() //puts the contents of the dataset into the variable dataHtml formatted as an html table
globals.Text10 = ‘’+dataset.getAsHTML()+‘’
The order_Number is the data provider from the selected record node. If I replace it with a record number “S243” , it works fine. I must be missing some simple syntax.
Basically what I guess is happening is that the order number contains a value of the current record “S240”, it says that is cannot find the column ‘S240’ to complete the query in the table. I am at home so I cant capture the error.
Seems like it cant see the difference of the hardcoded Select statement and the data provider value I selected order_number, I selected from the node in the method editor
How can I edit the default HTML output.
For example:
I want to format the Item_Total to refelct currency format w/ 2 decimal spaces.
I also want to edit the table padding etc. Would I need to capture the dataset as an array, so that I could format specific rows, and tables with html
Or can I edit the output after I run this code.
var DataHtml = dataset.getAsHTML() //puts the contents of the dataset into the variable dataHtml formatted as an html table
globals.Text10 = ‘’+dataset.getAsHTML()+‘’
I noticed if I see my output global to text area I can see the html.