Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Writing to table from external application(trouble write to a table from a Java app)
Writing to table from external application [message #818025] Sun, 11 March 2012 02:04 Go to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
I have a java application that queries a database and returns a bunch of values in a certain format. I verified that everything writes to the Netbeans console window without any problems, but when I try to use BIRT to create a PDF of the same data some of it doesn't show up. The PDF gets created and my program seems to pass all of the static values (too a couple of grid controls) without any problems, but when I try to print to a table nothing gets printed.

I created the table and set it to use a scripted data source. The columns are: [Food Description][Amount][Calories][Carbohydrates][Proteins][Fat]

Then from my Java program I am just looping the following code to try to populate the table. In theory, each iteration through my loop was supposed to write 3 rows into the table. Any ideas? Thanks.

               String FD = "";
               String AMT = "";
               String CAL = "";
               String Carbs = "";
               String PT = "";
               String FT = "";
               
               FD = proteinArray[0];
               AMT = proteinArray[1];
               CAL = proteinArray[2];
               Carbs = proteinArray[3];
               PT = proteinArray[4];
               FT = proteinArray[5];
               
               runTask.setParameterValue("FD", FD);
               runTask.setParameterValue("AMT", AMT);
               runTask.setParameterValue("CAL", CAL);
               runTask.setParameterValue("Carbs", Carbs);
               runTask.setParameterValue("PT", PT);
               runTask.setParameterValue("FT", FT);
               
               FD = carbArray[0];
               AMT = carbArray[1];
               CAL = carbArray[2];
               Carbs = carbArray[3];
               PT = carbArray[4];
               FT = carbArray[5];
               
               runTask.setParameterValue("FD", FD);
               runTask.setParameterValue("AMT", AMT);
               runTask.setParameterValue("CAL", CAL);
               runTask.setParameterValue("Carbs", Carbs);
               runTask.setParameterValue("PT", PT);
               runTask.setParameterValue("FT", FT);
               
               FD = vegArray[0];
               AMT = vegArray[1];
               CAL = vegArray[2];
               Carbs = vegArray[3];
               PT = vegArray[4];
               FT = vegArray[5];
               
               runTask.setParameterValue("FD", FD);
               runTask.setParameterValue("AMT", AMT);
               runTask.setParameterValue("CAL", CAL);
               runTask.setParameterValue("Carbs", Carbs);
               runTask.setParameterValue("PT", PT);
               runTask.setParameterValue("FT", FT);




Re: Writing to table from external application [message #819198 is a reply to message #818025] Mon, 12 March 2012 15:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Brad,

What are your parameter types for the report. For example:
runTask.setParameterValue("FD"....

What is the parameter type for FD in the report design?

Jason


On 3/10/2012 9:04 PM, Brad Rarick wrote:
> I have a java application that queries a database and returns a bunch of
> values in a certain format. I verified that everything writes to the
> Netbeans console window without any problems, but when I try to use BIRT
> to create a PDF of the same data some of it doesn't show up. The PDF
> gets created and my program seems to pass all of the static values (too
> a couple of grid controls) without any problems, but when I try to print
> to a table nothing gets printed.
>
> I created the table and set it to use a scripted data source. The
> columns are: [Food
> Description][Amount][Calories][Carbohydrates][Proteins][Fat]
>
> Then from my Java program I am just looping the following code to try to
> populate the table. In theory, each iteration through my loop was
> supposed to write 3 rows into the table. Any ideas? Thanks.
>
>
> String FD = "";
> String AMT = "";
> String CAL = "";
> String Carbs = "";
> String PT = "";
> String FT = "";
> FD = proteinArray[0];
> AMT = proteinArray[1];
> CAL = proteinArray[2];
> Carbs = proteinArray[3];
> PT = proteinArray[4];
> FT = proteinArray[5];
> runTask.setParameterValue("FD", FD);
> runTask.setParameterValue("AMT", AMT);
> runTask.setParameterValue("CAL", CAL);
> runTask.setParameterValue("Carbs", Carbs);
> runTask.setParameterValue("PT", PT);
> runTask.setParameterValue("FT", FT);
> FD = carbArray[0];
> AMT = carbArray[1];
> CAL = carbArray[2];
> Carbs = carbArray[3];
> PT = carbArray[4];
> FT = carbArray[5];
> runTask.setParameterValue("FD", FD);
> runTask.setParameterValue("AMT", AMT);
> runTask.setParameterValue("CAL", CAL);
> runTask.setParameterValue("Carbs", Carbs);
> runTask.setParameterValue("PT", PT);
> runTask.setParameterValue("FT", FT);
> FD = vegArray[0];
> AMT = vegArray[1];
> CAL = vegArray[2];
> Carbs = vegArray[3];
> PT = vegArray[4];
> FT = vegArray[5];
> runTask.setParameterValue("FD", FD);
> runTask.setParameterValue("AMT", AMT);
> runTask.setParameterValue("CAL", CAL);
> runTask.setParameterValue("Carbs", Carbs);
> runTask.setParameterValue("PT", PT);
> runTask.setParameterValue("FT", FT);
>
>
>
>
Re: Writing to table from external application [message #819357 is a reply to message #819198] Mon, 12 March 2012 20:33 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
They are both strings.

In my Java app I have the elements in each string array being set to a string variable. The code has changed slightly as to what is above as I have been messing with it on and off all day.
               String proteinArray[] = protein.split(delims);
               String carbArray[] = carb.split(delims);
               String vegArray[] = veg.split(delims);
              
               
               String FD = "";
               String AMT = "";
               String CAL = "";
               String Carbs = "";
               String PT = "";
               String FT = "";
               
               FD = proteinArray[0];
               AMT = proteinArray[1];
               CAL = proteinArray[2];
               Carbs = proteinArray[3];
               PT = proteinArray[4];
               FT = proteinArray[5];

               runTask.setParameterValue("Food Description", FD);
               runTask.setParameterValue("Amount", AMT);
               runTask.setParameterValue("Calories", CAL);
               runTask.setParameterValue("Carbohydrates", Carbs);
               runTask.setParameterValue("Protein", PT);
               runTask.setParameterValue("Fat", FT);

I then created 6 report parameters called "Food Description", "Amount", "Calories", "Carbohydrates", "Protein", and "Fat". These are all of datatype String and hidden.

I then bound the 6 report parameters to the 6 data set parameters for the table. The binding properties of one of the columns looks like...

Data Set: None

Data Column Binding
-------------------
Name: Food Description
Display Name: Food Description
Data Type: String
Expression: params["Food Description"].value
Re: Writing to table from external application [message #819399 is a reply to message #819357] Mon, 12 March 2012 21:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you post the report design?

Jason

On 3/12/2012 4:33 PM, Brad Rarick wrote:
> They are both strings.
>
> In my Java app I have the elements in each string array being set to a
> string variable. The code has changed slightly as to what is above as I
> have been messing with it on and off all day.
>
> String proteinArray[] = protein.split(delims);
> String carbArray[] = carb.split(delims);
> String vegArray[] = veg.split(delims);
> String FD = "";
> String AMT = "";
> String CAL = "";
> String Carbs = "";
> String PT = "";
> String FT = "";
> FD = proteinArray[0];
> AMT = proteinArray[1];
> CAL = proteinArray[2];
> Carbs = proteinArray[3];
> PT = proteinArray[4];
> FT = proteinArray[5];
>
> runTask.setParameterValue("Food Description", FD);
> runTask.setParameterValue("Amount", AMT);
> runTask.setParameterValue("Calories", CAL);
> runTask.setParameterValue("Carbohydrates", Carbs);
> runTask.setParameterValue("Protein", PT);
> runTask.setParameterValue("Fat", FT);
>
> I then created 6 report parameters called "Food Description", "Amount",
> "Calories", "Carbohydrates", "Protein", and "Fat". These are all of
> datatype String and hidden.
>
> I then bound the 6 report parameters to the 6 data set parameters for
> the table. The binding properties of one of the columns looks like...
>
> Data Set: None
>
> Data Column Binding
> -------------------
> Name: Food Description
> Display Name: Food Description
> Data Type: String
> Expression: params["Food Description"].value
Re: Writing to table from external application [message #819462 is a reply to message #819399] Mon, 12 March 2012 23:55 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Sure thing Smile The design xml is below...

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="h**p://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 3.7.2.v20120213 Build &lt;3.7.2.v20120214-1408></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="layoutPreference">fixed layout</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <parameters>
        <parameter-group name="Client Information" id="21">
            <text-property name="displayName">Client Information</text-property>
            <parameters>
                <scalar-parameter name="ClientFirstName" id="17">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <simple-property-list name="defaultValue">
                        <value type="constant">None</value>
                    </simple-property-list>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientMiddleName" id="19">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientLastName" id="22">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientAddress" id="23">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientCity" id="24">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientZipcode" id="27">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientPhone" id="25">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="ClientEmail" id="26">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
            </parameters>
        </parameter-group>
        <parameter-group name="Trainer Information" id="36">
            <text-property name="displayName">Trainer Information</text-property>
            <parameters>
                <scalar-parameter name="TrainerFirstName" id="37">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerMiddleName" id="38">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerLastName" id="39">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerPhone" id="40">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerEmail" id="41">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerCertification" id="42">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerGym" id="43">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="TrainerExperience" id="44">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
            </parameters>
        </parameter-group>
        <parameter-group name="Client Goals" id="45">
            <text-property name="displayName">Client Goals</text-property>
            <parameters>
                <scalar-parameter name="CurrentWeight" id="46">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">integer</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="GoalWeight" id="47">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">integer</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="GoalPounds" id="48">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">integer</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="CaloriesToLose" id="49">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">integer</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="DietLength" id="50">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">integer</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
            </parameters>
        </parameter-group>
        <parameter-group name="Meal Group" id="303">
            <parameters>
                <scalar-parameter name="Food Description" id="305">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="Amount" id="306">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="Calories" id="307">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="Carbohydrates" id="308">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="Protein" id="304">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
                <scalar-parameter name="Fat" id="309">
                    <property name="hidden">true</property>
                    <property name="valueType">static</property>
                    <property name="isRequired">false</property>
                    <property name="dataType">string</property>
                    <property name="distinct">true</property>
                    <list-property name="selectionList"/>
                    <property name="paramType">simple</property>
                    <property name="controlType">text-box</property>
                    <structure name="format">
                        <property name="category">Unformatted</property>
                    </structure>
                </scalar-parameter>
            </parameters>
        </parameter-group>
    </parameters>
    <data-sources>
        <script-data-source name="Diet_Buddy" id="218"/>
    </data-sources>
    <data-sets>
        <script-data-set name="Meal" id="219">
            <list-property name="resultSetHints">
                <structure>
                    <property name="position">1</property>
                    <property name="name">Food_Decription</property>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="position">2</property>
                    <property name="name">Amount</property>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="position">3</property>
                    <property name="name">Calories</property>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="position">4</property>
                    <property name="name">Carbohydrates</property>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="position">5</property>
                    <property name="name">Protein</property>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="position">6</property>
                    <property name="name">Fat</property>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">Food_Decription</property>
                    <property name="alias">FD</property>
                    <text-property name="displayName">Food Desciption</text-property>
                </structure>
                <structure>
                    <property name="columnName">Amount</property>
                    <property name="alias">AMT</property>
                    <text-property name="displayName">Amount</text-property>
                </structure>
                <structure>
                    <property name="columnName">Calories</property>
                    <property name="alias">CAL</property>
                    <text-property name="displayName">Calories</text-property>
                </structure>
                <structure>
                    <property name="columnName">Carbohydrates</property>
                    <property name="alias">Carbs</property>
                    <text-property name="displayName">Carbohydrates</text-property>
                </structure>
                <structure>
                    <property name="columnName">Protein</property>
                    <property name="alias">PT</property>
                    <text-property name="displayName">Protein</text-property>
                </structure>
                <structure>
                    <property name="columnName">Fat</property>
                    <property name="alias">FT</property>
                    <text-property name="displayName">Fat</text-property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">FD</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">2</property>
                        <property name="name">AMT</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">3</property>
                        <property name="name">CAL</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">4</property>
                        <property name="name">Carbs</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">5</property>
                        <property name="name">PT</property>
                        <property name="dataType">string</property>
                    </structure>
                    <structure>
                        <property name="position">6</property>
                        <property name="name">FT</property>
                        <property name="dataType">string</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">Diet_Buddy</property>
        </script-data-set>
    </data-sets>
    <styles>
        <style name="report" id="4">
            <property name="fontFamily">sans-serif</property>
            <property name="fontSize">10pt</property>
        </style>
        <style name="crosstab-cell" id="5">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
        <style name="crosstab" id="6">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2">
            <page-footer>
                <text id="3">
                    <property name="textAlign">right</property>
                </text>
            </page-footer>
        </simple-master-page>
    </page-setup>
    <body>
        <label id="7">
            <property name="backgroundColor">#C0C0C0</property>
            <property name="fontFamily">"Calibri"</property>
            <property name="fontSize">24pt</property>
            <property name="color">#0000FF</property>
            <property name="textUnderline">none</property>
            <property name="borderBottomColor">#000000</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">thin</property>
            <property name="borderLeftColor">#000000</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">thin</property>
            <property name="borderRightColor">#000000</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">thin</property>
            <property name="borderTopColor">#000000</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">thin</property>
            <property name="textAlign">center</property>
            <text-property name="text">Client Diet</text-property>
        </label>
        <label id="11">
            <property name="fontFamily">"Calibri"</property>
            <property name="fontSize">12pt</property>
            <property name="textAlign">center</property>
            <text-property name="text">Created by Diet Buddy</text-property>
        </label>
        <data id="16">
            <property name="textAlign">right</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">curent_date</property>
                    <text-property name="displayName">current_date</text-property>
                    <expression name="expression" type="javascript">new Date()</expression>
                    <property name="dataType">date-time</property>
                    <property name="allowExport">true</property>
                </structure>
            </list-property>
            <property name="resultSetColumn">curent_date</property>
        </data>
        <label id="83">
            <property name="fontSize">12pt</property>
            <property name="fontWeight">bold</property>
            <property name="textUnderline">underline</property>
            <text-property name="text">Client Information</text-property>
        </label>
        <grid id="62">
            <property name="height">2.2083333333333335in</property>
            <property name="width">7.947916666666667in</property>
            <column id="63">
                <property name="width">1.0520833333333333in</property>
            </column>
            <column id="64">
                <property name="width">6.895833333333333in</property>
            </column>
            <row id="65">
                <cell id="66">
                    <label id="60">
                        <property name="display">block</property>
                        <text-property name="text">First Name:   </text-property>
                    </label>
                </cell>
                <cell id="67">
                    <data id="28">
                        <property name="display">block</property>
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientFirstName</property>
                                <expression name="expression" type="javascript">params["ClientFirstName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientFirstName</property>
                    </data>
                </cell>
            </row>
            <row id="68">
                <cell id="69">
                    <label id="61">
                        <property name="display">block</property>
                        <text-property name="text">Middle Name:  </text-property>
                    </label>
                </cell>
                <cell id="70">
                    <data id="29">
                        <property name="display">block</property>
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientMiddleName</property>
                                <expression name="expression" type="javascript">params["ClientMiddleName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientMiddleName</property>
                    </data>
                </cell>
            </row>
            <row id="71">
                <cell id="72">
                    <label id="84">
                        <text-property name="text">Last Name:</text-property>
                    </label>
                </cell>
                <cell id="73">
                    <data id="85">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientLastName</property>
                                <expression name="expression" type="javascript">params["ClientLastName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientLastName</property>
                    </data>
                </cell>
            </row>
            <row id="74">
                <cell id="75">
                    <label id="89">
                        <text-property name="text">Address:</text-property>
                    </label>
                </cell>
                <cell id="76">
                    <data id="86">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientAddress</property>
                                <expression name="expression" type="javascript">params["ClientAddress"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientAddress</property>
                    </data>
                </cell>
            </row>
            <row id="77">
                <cell id="78">
                    <label id="90">
                        <text-property name="text">City:</text-property>
                    </label>
                </cell>
                <cell id="79">
                    <data id="87">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientCity</property>
                                <expression name="expression" type="javascript">params["ClientCity"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientCity</property>
                    </data>
                </cell>
            </row>
            <row id="80">
                <cell id="81">
                    <label id="91">
                        <text-property name="text">Zipcode:</text-property>
                    </label>
                </cell>
                <cell id="82">
                    <data id="88">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientZipcode</property>
                                <expression name="expression" type="javascript">params["ClientZipcode"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientZipcode</property>
                    </data>
                </cell>
            </row>
            <row id="92">
                <cell id="93">
                    <label id="100">
                        <text-property name="text">Phone:</text-property>
                    </label>
                </cell>
                <cell id="94">
                    <data id="98">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientPhone</property>
                                <expression name="expression" type="javascript">params["ClientPhone"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientPhone</property>
                    </data>
                </cell>
            </row>
            <row id="95">
                <property name="height">0.3020833333333333in</property>
                <cell id="96">
                    <label id="101">
                        <text-property name="text">Email:</text-property>
                    </label>
                </cell>
                <cell id="97">
                    <data id="99">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">ClientEmail</property>
                                <expression name="expression" type="javascript">params["ClientEmail"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">ClientEmail</property>
                    </data>
                </cell>
            </row>
        </grid>
        <label id="102">
            <property name="fontSize">12pt</property>
            <property name="fontWeight">bold</property>
            <property name="textUnderline">underline</property>
            <text-property name="text">Trainer Information</text-property>
        </label>
        <grid id="103">
            <property name="height">2.2083333333333335in</property>
            <property name="width">7.947916666666667in</property>
            <column id="104">
                <property name="width">1.0520833333333333in</property>
            </column>
            <column id="105">
                <property name="width">6.895833333333333in</property>
            </column>
            <row id="106">
                <cell id="107">
                    <label id="130">
                        <text-property name="text">First Name:</text-property>
                    </label>
                </cell>
                <cell id="108">
                    <data id="138">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerFirstName</property>
                                <expression name="expression" type="javascript">params["TrainerFirstName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerFirstName</property>
                    </data>
                </cell>
            </row>
            <row id="109">
                <cell id="110">
                    <label id="131">
                        <text-property name="text">Middle Name:</text-property>
                    </label>
                </cell>
                <cell id="111">
                    <data id="139">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerMiddleName</property>
                                <expression name="expression" type="javascript">params["TrainerMiddleName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerMiddleName</property>
                    </data>
                </cell>
            </row>
            <row id="112">
                <cell id="113">
                    <label id="132">
                        <text-property name="text">Last Name:</text-property>
                    </label>
                </cell>
                <cell id="114">
                    <data id="140">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerLastName</property>
                                <expression name="expression" type="javascript">params["TrainerLastName"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerLastName</property>
                    </data>
                </cell>
            </row>
            <row id="115">
                <cell id="116">
                    <label id="133">
                        <text-property name="text">Phone:</text-property>
                    </label>
                </cell>
                <cell id="117">
                    <data id="141">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerPhone</property>
                                <expression name="expression" type="javascript">params["TrainerPhone"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerPhone</property>
                    </data>
                </cell>
            </row>
            <row id="118">
                <cell id="119">
                    <label id="134">
                        <text-property name="text">Email:</text-property>
                    </label>
                </cell>
                <cell id="120">
                    <data id="142">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerEmail</property>
                                <expression name="expression" type="javascript">params["TrainerEmail"]</expression>
                                <property name="dataType">string</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerEmail</property>
                    </data>
                </cell>
            </row>
            <row id="121">
                <cell id="122">
                    <label id="135">
                        <text-property name="text">Certification:</text-property>
                    </label>
                </cell>
                <cell id="123">
                    <data id="143">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerCertification</property>
                                <expression name="expression" type="javascript">params["TrainerCertification"]</expression>
                                <property name="dataType">javaObject</property>
                                <property name="allowExport">true</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerCertification</property>
                    </data>
                </cell>
            </row>
            <row id="124">
                <cell id="125">
                    <label id="136">
                        <text-property name="text">Gym Affiliation:</text-property>
                    </label>
                </cell>
                <cell id="126">
                    <data id="144">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerGym</property>
                                <expression name="expression" type="javascript">params["TrainerGym"]</expression>
                                <property name="dataType">javaObject</property>
                                <property name="allowExport">true</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerGym</property>
                    </data>
                </cell>
            </row>
            <row id="127">
                <property name="height">0.3020833333333333in</property>
                <cell id="128">
                    <label id="137">
                        <text-property name="text">Year of Exp:</text-property>
                    </label>
                </cell>
                <cell id="129">
                    <data id="145">
                        <list-property name="boundDataColumns">
                            <structure>
                                <property name="name">TrainerExperience</property>
                                <expression name="expression" type="javascript">params["TrainerExperience"]</expression>
                                <property name="dataType">javaObject</property>
                                <property name="allowExport">true</property>
                            </structure>
                        </list-property>
                        <property name="resultSetColumn">TrainerExperience</property>
                    </data>
                </cell>
            </row>
        </grid>
        <label id="146">
            <property name="fontSize">12pt</property>
            <property name="fontWeight">bold</property>
            <property name="textUnderline">underline</property>
            <text-property name="text">Diet Statistics</text-property>
        </label>
        <grid id="147">
            <property name="height">1.3958333333333333in</property>
            <property name="width">7.947916666666667in</property>
            <column id="148">
                <property name="width">1.8645833333333333in</property>
            </column>
            <column id="149">
                <property name="width">6.083333333333333in</property>
            </column>
            <row id="150">
                <cell



Re: Writing to table from external application [message #820041 is a reply to message #819462] Tue, 13 March 2012 16:47 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you attach the report, instead of copying the xml?

Jason

On 3/12/2012 7:55 PM, Brad Rarick wrote:
> Sure thing :) The design xml is below...
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="h**p://www.eclipse.org/birt/2005/design" version="3.2.23"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version 3.7.2.v20120213
> Build <3.7.2.v20120214-1408></property>
> <property name="units">in</property>
> <property name="iconFile">/templates/blank_report.gif</property>
> <property name="layoutPreference">fixed layout</property>
> <property name="bidiLayoutOrientation">ltr</property>
> <property name="imageDPI">96</property>
> <parameters>
> <parameter-group name="Client Information" id="21">
> <text-property name="displayName">Client Information</text-property>
> <parameters>
> <scalar-parameter name="ClientFirstName" id="17">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <simple-property-list name="defaultValue">
> <value type="constant">None</value>
> </simple-property-list>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientMiddleName" id="19">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientLastName" id="22">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientAddress" id="23">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientCity" id="24">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientZipcode" id="27">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientPhone" id="25">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="ClientEmail" id="26">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> </parameters>
> </parameter-group>
> <parameter-group name="Trainer Information" id="36">
> <text-property name="displayName">Trainer Information</text-property>
> <parameters>
> <scalar-parameter name="TrainerFirstName" id="37">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerMiddleName" id="38">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerLastName" id="39">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerPhone" id="40">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerEmail" id="41">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerCertification" id="42">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerGym" id="43">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="TrainerExperience" id="44">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> </parameters>
> </parameter-group>
> <parameter-group name="Client Goals" id="45">
> <text-property name="displayName">Client Goals</text-property>
> <parameters>
> <scalar-parameter name="CurrentWeight" id="46">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">integer</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="GoalWeight" id="47">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">integer</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="GoalPounds" id="48">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">integer</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="CaloriesToLose" id="49">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">integer</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="DietLength" id="50">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">integer</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> </parameters>
> </parameter-group>
> <parameter-group name="Meal Group" id="303">
> <parameters>
> <scalar-parameter name="Food Description" id="305">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="Amount" id="306">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="Calories" id="307">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="Carbohydrates" id="308">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="Protein" id="304">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> <scalar-parameter name="Fat" id="309">
> <property name="hidden">true</property>
> <property name="valueType">static</property>
> <property name="isRequired">false</property>
> <property name="dataType">string</property>
> <property name="distinct">true</property>
> <list-property name="selectionList"/>
> <property name="paramType">simple</property>
> <property name="controlType">text-box</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> </parameters>
> </parameter-group>
> </parameters>
> <data-sources>
> <script-data-source name="Diet_Buddy" id="218"/>
> </data-sources>
> <data-sets>
> <script-data-set name="Meal" id="219">
> <list-property name="resultSetHints">
> <structure>
> <property name="position">1</property>
> <property name="name">Food_Decription</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">Amount</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">Calories</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">Carbohydrates</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">5</property>
> <property name="name">Protein</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">6</property>
> <property name="name">Fat</property>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <list-property name="columnHints">
> <structure>
> <property name="columnName">Food_Decription</property>
> <property name="alias">FD</property>
> <text-property name="displayName">Food Desciption</text-property>
> </structure>
> <structure>
> <property name="columnName">Amount</property>
> <property name="alias">AMT</property>
> <text-property name="displayName">Amount</text-property>
> </structure>
> <structure>
> <property name="columnName">Calories</property>
> <property name="alias">CAL</property>
> <text-property name="displayName">Calories</text-property>
> </structure>
> <structure>
> <property name="columnName">Carbohydrates</property>
> <property name="alias">Carbs</property>
> <text-property name="displayName">Carbohydrates</text-property>
> </structure>
> <structure>
> <property name="columnName">Protein</property>
> <property name="alias">PT</property>
> <text-property name="displayName">Protein</text-property>
> </structure>
> <structure>
> <property name="columnName">Fat</property>
> <property name="alias">FT</property>
> <text-property name="displayName">Fat</text-property>
> </structure>
> </list-property>
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">FD</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">AMT</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">CAL</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">Carbs</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">5</property>
> <property name="name">PT</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">6</property>
> <property name="name">FT</property>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Diet_Buddy</property>
> </script-data-set>
> </data-sets>
> <styles>
> <style name="report" id="4">
> <property name="fontFamily">sans-serif</property>
> <property name="fontSize">10pt</property>
> </style>
> <style name="crosstab-cell" id="5">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="crosstab" id="6">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> </styles>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2">
> <page-footer>
> <text id="3">
> <property name="textAlign">right</property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <label id="7">
> <property name="backgroundColor">#C0C0C0</property>
> <property name="fontFamily">"Calibri"</property>
> <property name="fontSize">24pt</property>
> <property name="color">#0000FF</property>
> <property name="textUnderline">none</property>
> <property name="borderBottomColor">#000000</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">thin</property>
> <property name="borderLeftColor">#000000</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">thin</property>
> <property name="borderRightColor">#000000</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">thin</property>
> <property name="borderTopColor">#000000</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">thin</property>
> <property name="textAlign">center</property>
> <text-property name="text">Client Diet</text-property>
> </label>
> <label id="11">
> <property name="fontFamily">"Calibri"</property>
> <property name="fontSize">12pt</property>
> <property name="textAlign">center</property>
> <text-property name="text">Created by Diet Buddy</text-property>
> </label>
> <data id="16">
> <property name="textAlign">right</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">curent_date</property>
> <text-property name="displayName">current_date</text-property>
> <expression name="expression" type="javascript">new Date()</expression>
> <property name="dataType">date-time</property>
> <property name="allowExport">true</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">curent_date</property>
> </data>
> <label id="83">
> <property name="fontSize">12pt</property>
> <property name="fontWeight">bold</property>
> <property name="textUnderline">underline</property>
> <text-property name="text">Client Information</text-property>
> </label>
> <grid id="62">
> <property name="height">2.2083333333333335in</property>
> <property name="width">7.947916666666667in</property>
> <column id="63">
> <property name="width">1.0520833333333333in</property>
> </column>
> <column id="64">
> <property name="width">6.895833333333333in</property>
> </column>
> <row id="65">
> <cell id="66">
> <label id="60">
> <property name="display">block</property>
> <text-property name="text">First Name: </text-property>
> </label>
> </cell>
> <cell id="67">
> <data id="28">
> <property name="display">block</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientFirstName</property>
> <expression name="expression"
> type="javascript">params["ClientFirstName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientFirstName</property>
> </data>
> </cell>
> </row>
> <row id="68">
> <cell id="69">
> <label id="61">
> <property name="display">block</property>
> <text-property name="text">Middle Name: </text-property>
> </label>
> </cell>
> <cell id="70">
> <data id="29">
> <property name="display">block</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientMiddleName</property>
> <expression name="expression"
> type="javascript">params["ClientMiddleName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientMiddleName</property>
> </data>
> </cell>
> </row>
> <row id="71">
> <cell id="72">
> <label id="84">
> <text-property name="text">Last Name:</text-property>
> </label>
> </cell>
> <cell id="73">
> <data id="85">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientLastName</property>
> <expression name="expression"
> type="javascript">params["ClientLastName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientLastName</property>
> </data>
> </cell>
> </row>
> <row id="74">
> <cell id="75">
> <label id="89">
> <text-property name="text">Address:</text-property>
> </label>
> </cell>
> <cell id="76">
> <data id="86">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientAddress</property>
> <expression name="expression"
> type="javascript">params["ClientAddress"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientAddress</property>
> </data>
> </cell>
> </row>
> <row id="77">
> <cell id="78">
> <label id="90">
> <text-property name="text">City:</text-property>
> </label>
> </cell>
> <cell id="79">
> <data id="87">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientCity</property>
> <expression name="expression"
> type="javascript">params["ClientCity"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientCity</property>
> </data>
> </cell>
> </row>
> <row id="80">
> <cell id="81">
> <label id="91">
> <text-property name="text">Zipcode:</text-property>
> </label>
> </cell>
> <cell id="82">
> <data id="88">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientZipcode</property>
> <expression name="expression"
> type="javascript">params["ClientZipcode"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientZipcode</property>
> </data>
> </cell>
> </row>
> <row id="92">
> <cell id="93">
> <label id="100">
> <text-property name="text">Phone:</text-property>
> </label>
> </cell>
> <cell id="94">
> <data id="98">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientPhone</property>
> <expression name="expression"
> type="javascript">params["ClientPhone"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientPhone</property>
> </data>
> </cell>
> </row>
> <row id="95">
> <property name="height">0.3020833333333333in</property>
> <cell id="96">
> <label id="101">
> <text-property name="text">Email:</text-property>
> </label>
> </cell>
> <cell id="97">
> <data id="99">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ClientEmail</property>
> <expression name="expression"
> type="javascript">params["ClientEmail"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">ClientEmail</property>
> </data>
> </cell>
> </row>
> </grid>
> <label id="102">
> <property name="fontSize">12pt</property>
> <property name="fontWeight">bold</property>
> <property name="textUnderline">underline</property>
> <text-property name="text">Trainer Information</text-property>
> </label>
> <grid id="103">
> <property name="height">2.2083333333333335in</property>
> <property name="width">7.947916666666667in</property>
> <column id="104">
> <property name="width">1.0520833333333333in</property>
> </column>
> <column id="105">
> <property name="width">6.895833333333333in</property>
> </column>
> <row id="106">
> <cell id="107">
> <label id="130">
> <text-property name="text">First Name:</text-property>
> </label>
> </cell>
> <cell id="108">
> <data id="138">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerFirstName</property>
> <expression name="expression"
> type="javascript">params["TrainerFirstName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerFirstName</property>
> </data>
> </cell>
> </row>
> <row id="109">
> <cell id="110">
> <label id="131">
> <text-property name="text">Middle Name:</text-property>
> </label>
> </cell>
> <cell id="111">
> <data id="139">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerMiddleName</property>
> <expression name="expression"
> type="javascript">params["TrainerMiddleName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerMiddleName</property>
> </data>
> </cell>
> </row>
> <row id="112">
> <cell id="113">
> <label id="132">
> <text-property name="text">Last Name:</text-property>
> </label>
> </cell>
> <cell id="114">
> <data id="140">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerLastName</property>
> <expression name="expression"
> type="javascript">params["TrainerLastName"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerLastName</property>
> </data>
> </cell>
> </row>
> <row id="115">
> <cell id="116">
> <label id="133">
> <text-property name="text">Phone:</text-property>
> </label>
> </cell>
> <cell id="117">
> <data id="141">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerPhone</property>
> <expression name="expression"
> type="javascript">params["TrainerPhone"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerPhone</property>
> </data>
> </cell>
> </row>
> <row id="118">
> <cell id="119">
> <label id="134">
> <text-property name="text">Email:</text-property>
> </label>
> </cell>
> <cell id="120">
> <data id="142">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerEmail</property>
> <expression name="expression"
> type="javascript">params["TrainerEmail"]</expression>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerEmail</property>
> </data>
> </cell>
> </row>
> <row id="121">
> <cell id="122">
> <label id="135">
> <text-property name="text">Certification:</text-property>
> </label>
> </cell>
> <cell id="123">
> <data id="143">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerCertification</property>
> <expression name="expression"
> type="javascript">params["TrainerCertification"]</expression>
> <property name="dataType">javaObject</property>
> <property name="allowExport">true</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerCertification</property>
> </data>
> </cell>
> </row>
> <row id="124">
> <cell id="125">
> <label id="136">
> <text-property name="text">Gym Affiliation:</text-property>
> </label>
> </cell>
> <cell id="126">
> <data id="144">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerGym</property>
> <expression name="expression"
> type="javascript">params["TrainerGym"]</expression>
> <property name="dataType">javaObject</property>
> <property name="allowExport">true</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerGym</property>
> </data>
> </cell>
> </row>
> <row id="127">
> <property name="height">0.3020833333333333in</property>
> <cell id="128">
> <label id="137">
> <text-property name="text">Year of Exp:</text-property>
> </label>
> </cell>
> <cell id="129">
> <data id="145">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">TrainerExperience</property>
> <expression name="expression"
> type="javascript">params["TrainerExperience"]</expression>
> <property name="dataType">javaObject</property>
> <property name="allowExport">true</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">TrainerExperience</property>
> </data>
> </cell>
> </row>
> </grid>
> <label id="146">
> <property name="fontSize">12pt</property>
> <property name="fontWeight">bold</property>
> <property name="textUnderline">underline</property>
> <text-property name="text">Diet Statistics</text-property>
> </label>
> <grid id="147">
> <property name="height">1.3958333333333333in</property>
> <property name="width">7.947916666666667in</property>
> <column id="148">
> <property name="width">1.8645833333333333in</property>
> </column>
> <column id="149">
> <property name="width">6.083333333333333in</property>
> </column>
> <row id="150">
> <cell
Re: Writing to table from external application [message #820122 is a reply to message #818025] Tue, 13 March 2012 19:03 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
File is attached
Re: Writing to table from external application [message #821014 is a reply to message #820122] Wed, 14 March 2012 21:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Brad,

While you do have a scripted data set defined, you have no scripts in it
to process rows. Look at the attached report. Specifically it uses a
beforeFactory script (Runs before datasets) that loads up a hashmap,
this hash is then iterated over in the open and fetch events of the
scripted dataset. Instead of using the beforeFactory to load up the
hashmap you could do that in your java code and then add the hashmap to
the report engines appcontext. The beforeFactory script in the attached
example has a snippet of code to see how to do this.

Jason

On 3/13/2012 3:03 PM, Brad Rarick wrote:
> File is attached
Re: Writing to table from external application [message #821021 is a reply to message #821014] Wed, 14 March 2012 21:16 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Ah, that's where I went wrong. For some reason I was thinking that the table would magically iterate through each row as my loops chucked data at it. I will try to implement the hashmap tonight to see of I can get it working. Thanks for the help.
Re: Writing to table from external application [message #821595 is a reply to message #821021] Thu, 15 March 2012 15:27 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Still trying to get this to work...

Since each row in my table contains 6 items (Description, Amount, Calories, Carbs, Protein, and Fat) I figured it would be easier to store a list in each hashmap (which cleaned up my code alot).

So now I have 1 hashmap with 3 lists in it (protein, carb, and veg). Each list is supposed to write one row in my table.

So my Java program has this...
               map.put("protein", proteinList);
               map.put("carb", carbList);
               map.put("veg", vegList);

               runTask.getAppContext().put("Meal", map);



How do you tell the report to use a list to populate a row?

I assume the the iterater code will be the same:
  apphm = ReportContext.getAppContext().get("Meal");
  mealSet = apphm.entrySet();
  iter = mealSet.iterator();


What would the fetch code look like?

  if(iter.hasNext()) { 
    myIter = iter.next(); 

       //code to populate one row with a list     
 
    return true;
    } else {
    return false;
     }


Then how would you keep the table rows from being overwritten? My map is going to be populated a number of times because it runs in a loop. Is there a way to tell Birt no to overwrite rows that are already written too?
Re: Writing to table from external application [message #821799 is a reply to message #821595] Thu, 15 March 2012 20:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure what you mean. Why not use some code similar to:

//Java Side
Object Cols[6];
ArrayList myrows = new ArrayList();
//Description, Amount, Calories, Carbs, Protein, and Fat
Cols[0] = DescriptionValRow1;
Cols[1] = AmountValRow1;
Cols[2] = CaloriesValRow1;
..
..
..
myrows.add(Cols);
Cols[0] = DescriptionValRow2;
Cols[1] = AmountValRow2;
Cols[2] = CaloriesValRow2;
..
..
..
myrows.add(Cols);
..
..
..
runTask.getAppContext().put("myrows", myrows);

//Report Side
//Scripted data set
open method

myrows = reportContext().get("myrows");
ii=0;

fetch method

if( ii < myrows.size() ){
var currentrow = myrows.get(ii);
row["Description"] = currentrow[0];
row["Amount"] = currentrow[1];
row["Calories"] = currentrow[2];
..
..
..
i++;

}else{
return false;
}


Jason



On 3/15/2012 11:27 AM, Brad Rarick wrote:
> Still trying to get this to work...
>
> Since each row in my table contains 6 items (Description, Amount,
> Calories, Carbs, Protein, and Fat) I figured it would be easier to store
> a list in each hashmap (which cleaned up my code alot).
>
> So now I have 1 hashmap with 3 lists in it (protein, carb, and veg).
> Each list is supposed to write one row in my table.
> So my Java program has this...
>
> map.put("protein", proteinList);
> map.put("carb", carbList);
> map.put("veg", vegList);
>
> runTask.getAppContext().put("Meal", map);
>
>
>
> How do you tell the report to use a list to populate a row?
>
> I assume the the iterater code will be the same:
>
> apphm = ReportContext.getAppContext().get("Meal");
> mealSet = apphm.entrySet();
> iter = mealSet.iterator();
>
>
> What would the fetch code look like?
>
>
> if(iter.hasNext()) { myIter = iter.next();
> //code to populate one row with a list
> return true;
> } else {
> return false;
> }
>
>
> Then how would you keep the table rows from being overwritten? My map is
> going to be populated a number of times because it runs in a loop. Is
> there a way to tell Birt no to overwrite rows that are already written too?
>
Re: Writing to table from external application [message #822524 is a reply to message #821799] Fri, 16 March 2012 19:31 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
I think were almost there. I'm getting an error with the code above on the open script of the report.

master2 = reportContext().get("master2");
i=0;


There error:
WARNING: Fail to execute script in function __bm_OPEN(). Source:
------
" + master2 = reportContext().get("master2");
i=0;
 + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: reportContext is not a function, it is object. (/report/data-sets/script-data-set[@id="219"]/method[@name="open"]#1)
 Script source: /report/data-sets/script-data-set[@id="219"]/method[@name="open"], line: 0, text:


I figured since it was a type error that it had a problem with the type of array being passed in. So I tried to pass in an array or strings (master) and an array of objects (master2) and both got the same error. The report still has strings as the report parameters.

Have you seen this before? I will do some Googling to see what I come up with. Has to be something simple...
Re: Writing to table from external application [message #824413 is a reply to message #822524] Mon, 19 March 2012 16:30 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

instead of reportContext() use
reportContext.getAppContext().get("master2");

Jason

On 3/16/2012 3:31 PM, Brad Rarick wrote:
> I think were almost there. I'm getting an error with the code above on
> the open script of the report.
>
>
> master2 = reportContext().get("master2");
> i=0;
>
>
> There error:
>
> WARNING: Fail to execute script in function __bm_OPEN(). Source:
> ------
> " + master2 = reportContext().get("master2");
> i=0;
> + "
> -----
> A BIRT exception occurred. See next exception for more information.
> Error evaluating Javascript expression. Script engine error: TypeError:
> reportContext is not a function, it is object.
> (/report/data-sets/script-data-set[@id="219"]/method[@name="open"]#1)
> Script source:
> /report/data-sets/script-data-set[@id="219"]/method[@name="open"], line:
> 0, text:
>
>
> I figured since it was a type error that it had a problem with the type
> of array being passed in. So I tried to pass in an array or strings
> (master) and an array of objects (master2) and both got the same error.
> The report still has strings as the report parameters.
>
> Have you seen this before? I will do some Googling to see what I come up
> with. Has to be something simple...
>
Re: Writing to table from external application [message #824487 is a reply to message #824413] Mon, 19 March 2012 18:29 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
That cured the open method, but the fetch method still has some problems. I think the problem lies in the fact that currentrow is a var and can't be accessed with indexes.

if(i < master2.length){
  var currentrow = master2[i];
     row["Food Description"] = currentrow[0];
     row["Amount"] = currentrow[1];
     row["Calories"] = currentrow[2];
     row["Carbohydrates"] = currentrow[3]
     row["Protein"] = currentrow[4]
     row["Fat"] = currentrow[5]
  i++;
}else{
return false;
}


Error:
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: Java class "java.lang.String" has no public instance field or method named "0". (/report/data-sets/script-data-set[@id="219"]/method[@name="fetch"]#3)
 Script source: /report/data-sets/script-data-set[@id="219"]/method[@name="fetch"], line: 0, text:
__bm_FETCH()
org.eclipse.birt.data.engine.core.DataException: Fail to execute script in function __bm_FETCH(). Source:
------
" + if(i < master2.length){
  var currentrow = master2[i];
     row["Food Description"] = currentrow[0];
     row["Amount"] = currentrow[1];
     row["Calories"] = currentrow[2];
     row["Carbohydrates"] = currentrow[3]
     row["Protein"] = currentrow[4]
     row["Fat"] = currentrow[5]
  i++;
}else{
return false;
}
 + "
-----
Re: Writing to table from external application [message #824524 is a reply to message #824487] Mon, 19 March 2012 19:20 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Brad,

Try changing Object Cols[6]; to an arraylist as well.
ArrayList Cols;
ArrayList myrows = new ArrayList();
//Description, Amount, Calories, Carbs, Protein, and Fat
Cols.add(0,DescriptionValRow1);
Cols.add(1,Amount....

Then currentrow should be an array list object and you can then do:

row["Food Description"] = currentrow.get(0);

Jason

On 3/19/2012 2:29 PM, Brad Rarick wrote:
> That cured the open method, but the fetch method still has some
> problems. I think the problem lies in the fact that currentrow is a var
> and can't be accessed with indexes.
>
>
> if(i < master2.length){
> var currentrow = master2[i];
> row["Food Description"] = currentrow[0];
> row["Amount"] = currentrow[1];
> row["Calories"] = currentrow[2];
> row["Carbohydrates"] = currentrow[3]
> row["Protein"] = currentrow[4]
> row["Fat"] = currentrow[5]
> i++;
> }else{
> return false;
> }
>
>
> Error:
>
> A BIRT exception occurred. See next exception for more information.
> Error evaluating Javascript expression. Script engine error: Java class
> "java.lang.String" has no public instance field or method named "0".
> (/report/data-sets/script-data-set[@id="219"]/method[@name="fetch"]#3)
> Script source:
> /report/data-sets/script-data-set[@id="219"]/method[@name="fetch"],
> line: 0, text:
> __bm_FETCH()
> org.eclipse.birt.data.engine.core.DataException: Fail to execute script
> in function __bm_FETCH(). Source:
> ------
> " + if(i < master2.length){
> var currentrow = master2[i];
> row["Food Description"] = currentrow[0];
> row["Amount"] = currentrow[1];
> row["Calories"] = currentrow[2];
> row["Carbohydrates"] = currentrow[3]
> row["Protein"] = currentrow[4]
> row["Fat"] = currentrow[5]
> i++;
> }else{
> return false;
> }
> + "
> -----
>
Re: Writing to table from external application [message #824556 is a reply to message #824524] Mon, 19 March 2012 20:23 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Well that sounded good in theory Smile The same exact error still occurs. It doesn't like the index.

The current code of the program is below:

        ArrayList<String> columns = new ArrayList<String>();
        ArrayList<String> master = new ArrayList<String>();
            
        for(int a=1; a<size; a++){
               String protein = my_meals.get(index);
                   index++;
               String carb = my_meals.get(index);
                   index++;
               String veg = my_meals.get(index);
                   index++;
         
               String proteinArray[] = protein.split(delims);
               String carbArray[] = carb.split(delims);
               String vegArray[] = veg.split(delims);
               
               columns.add(0, proteinArray[0]);
               columns.add(1, proteinArray[1]);
               columns.add(2, proteinArray[2]);
               columns.add(3, proteinArray[3]);
               columns.add(4, proteinArray[4]);
               columns.add(5, proteinArray[5]);
               
               master.addAll(columns);
              
               columns.add(0, carbArray[0]);
               columns.add(1, carbArray[1]);
               columns.add(2, carbArray[2]);
               columns.add(3, carbArray[3]);
               columns.add(4, carbArray[4]);
               columns.add(5, carbArray[5]);
              
               master.addAll(columns);
                
               columns.add(0, vegArray[0]);
               columns.add(1, vegArray[1]);
               columns.add(2, vegArray[2]);
               columns.add(3, vegArray[3]);
               columns.add(4, vegArray[4]);
               columns.add(5, vegArray[5]);
              
               master.addAll(columns);
             
        }
            Object master2[] = master.toArray();
            runTask.getAppContext().put("master", master2);
Re: Writing to table from external application [message #824672 is a reply to message #824556] Mon, 19 March 2012 23:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take a look at the beforefactory and the scripted dataset on the
attached report.

Jason


On 3/19/2012 4:23 PM, Brad Rarick wrote:
> Well that sounded good in theory :) The same exact error still occurs.
> It doesn't like the index.
>
> The current code of the program is below:
>
>
> ArrayList<String> columns = new ArrayList<String>();
> ArrayList<String> master = new ArrayList<String>();
> for(int a=1; a<size; a++){
> String protein = my_meals.get(index);
> index++;
> String carb = my_meals.get(index);
> index++;
> String veg = my_meals.get(index);
> index++;
> String proteinArray[] = protein.split(delims);
> String carbArray[] = carb.split(delims);
> String vegArray[] = veg.split(delims);
> columns.add(0, proteinArray[0]);
> columns.add(1, proteinArray[1]);
> columns.add(2, proteinArray[2]);
> columns.add(3, proteinArray[3]);
> columns.add(4, proteinArray[4]);
> columns.add(5, proteinArray[5]);
> master.addAll(columns);
> columns.add(0, carbArray[0]);
> columns.add(1, carbArray[1]);
> columns.add(2, carbArray[2]);
> columns.add(3, carbArray[3]);
> columns.add(4, carbArray[4]);
> columns.add(5, carbArray[5]);
> master.addAll(columns);
> columns.add(0, vegArray[0]);
> columns.add(1, vegArray[1]);
> columns.add(2, vegArray[2]);
> columns.add(3, vegArray[3]);
> columns.add(4, vegArray[4]);
> columns.add(5, vegArray[5]);
> master.addAll(columns);
> }
> Object master2[] = master.toArray();
> runTask.getAppContext().put("master", master2);
>
Re: Writing to table from external application [message #825155 is a reply to message #824672] Tue, 20 March 2012 14:43 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
I just want to say, I'm buying everyone a beer (or 5) if this ever works Smile

OK, looking over you code I have 3 questions

- Your code uses size() on the open script, but when I try to use it I get an error that says "has no public instance field or method named "size"". Can I use array.length instead? Does it make a difference?

- Since I set all of my report values inside of my Java app (and write to the report API), do I need any code at all in the beforefactory method?

- If a sample of my master arraylist looks like the following:
Fish, tuna, light, canned in oil, drained solids
28.0
56
0
8
2
GARDENBURGER, Homestyle Classic Veggie Burger
66.0
113
7
12
6
Onions, frozen, whole, unprepared
321.0
113
27
3
0
Could my fetch method be something like this?
if(i < len){
  var currentrow = master[i];
     row["Food Description"] = currentrow[i];
     i++;
     row["Amount"] = currentrow.item[i];
     i++;
     row["Calories"] = currentrow.item[i];
     i++;
     row["Carbohydrates"] = currentrow.item[i];
     i++;
     row["Protein"] = currentrow.item[i];
     i++;
     row["Fat"] = currentrow.item[i];
     i++;
}else{
return false;
}



Re: Writing to table from external application [message #825158 is a reply to message #825155] Tue, 20 March 2012 14:47 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Sorry, the above has a typo. It should read...

if(i < len){
  var currentrow = master[i];
     row["Food Description"] = currentrow[i];
     i++;
     row["Amount"] = currentrow[i];
     i++;
     row["Calories"] = currentrow[i];
     i++;
     row["Carbohydrates"] = currentrow[i];
     i++;
     row["Protein"] = currentrow[i];
     i++;
     row["Fat"] = currentrow[i];
     i++;
}else{
return false;
}
Re: Writing to table from external application [message #825253 is a reply to message #825158] Tue, 20 March 2012 16:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Brad,

If your master object is an ArrayList size() should work. You may want
to add
importPackage(Packages.java.util);
importPackage(Packages.java.lang);

To your open script. If you can do a skype session we can get it to work.

Jason

On 3/20/2012 10:47 AM, Brad Rarick wrote:
> Sorry, the above has a typo. It should read...
>
>
> if(i < len){
> var currentrow = master[i];
> row["Food Description"] = currentrow[i];
> i++;
> row["Amount"] = currentrow[i];
> i++;
> row["Calories"] = currentrow[i];
> i++;
> row["Carbohydrates"] = currentrow[i];
> i++;
> row["Protein"] = currentrow[i];
> i++;
> row["Fat"] = currentrow[i];
> i++;
> }else{
> return false;
> }
>
Re: Writing to table from external application [message #825320 is a reply to message #825253] Tue, 20 March 2012 18:14 Go to previous messageGo to next message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
Importing the packages did the trick for the size problem. Unfortunately I am at work right now (working hard as you can tell Smile ) so Skyping isn't really an option right now. Do you have a plan B?
Re: Writing to table from external application [message #825366 is a reply to message #825320] Tue, 20 March 2012 19:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

We could always do after hours. After the import what error are you
getting?

Jason

On 3/20/2012 2:14 PM, Brad Rarick wrote:
> Importing the packages did the trick for the size problem. Unfortunately
> I am at work right now (working hard as you can tell :) ) so Skyping
> isn't really an option right now. Do you have a plan B?
Re: Writing to table from external application [message #825389 is a reply to message #825366] Tue, 20 March 2012 19:54 Go to previous message
Brad Rarick is currently offline Brad RarickFriend
Messages: 15
Registered: March 2012
Junior Member
The error is below. The fetch doesn't recognize master as being an array.

A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: Java class "java.lang.String" has no public instance field or method named "0". (/report/data-sets/script-data-set[@id="219"]/method[@name="fetch"]#3)
 Script source: /report/data-sets/script-data-set[@id="219"]/method[@name="fetch"], line: 0, text:
__bm_FETCH()
org.eclipse.birt.data.engine.core.DataException: Fail to execute script in function __bm_FETCH(). Source:
------
" + if(i < len){
  var currentrow = master[i];
     row["Food Description"] = currentrow[i];
     i++;
     row["Amount"] = currentrow[i];
     i++;
     row["Calories"] = currentrow[i];
     i++;
     row["Carbohydrates"] = currentrow[i];
     i++;
     row["Protein"] = currentrow[i];
     i++;
     row["Fat"] = currentrow[i];
     i++;
}else{
return false;
}
 + "
-----


The current state of the report is attached. There really isn't much to it.

The data coming in is one arraylist of Strings called master. As mentioned before, the contents of master mimic what is below. Every 6 indexes in the arraylist will be a row.

index  value
-----  -----
0      Fish, tuna, light, canned in oil, drained solids
1      28.0
2      56
3      0
4      8
5      2
6      GARDENBURGER, Homestyle Classic Veggie Burger
7      66.0
8      113
9      7
10     12
11     6
12     Onions, frozen, whole, unprepared
13     321.0
14     113
15     27
16     3
17     0
Previous Topic:Excel output
Next Topic:SEVERE: Unable to open connection.
Goto Forum:
  


Current Time: Thu Mar 28 19:56:35 GMT 2024

Powered by FUDForum. Page generated in 0.04147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top