Search
Monday, January 05, 2009 ..:: Forum ::.. Register  Login
 
  Forum  Templates  Tags & Template...   Syntax to retrieve all the records from a table
Previous Previous
 
Next Next
New Post 1/23/2008 5:43 PM
Resolved
  rfligg
43 posts
7th Level Poster


Syntax to retrieve all the records from a table  

 Hi All

I am trying to retrieve all the records from a table (select * from Northwind..Employees). Here is what i did:
1. Open Word.
2. Paste Windward syntax in Word as an rtf file.
3. Set my datasource using AutoTag
4. Save the rtf file
5. Run report and a blank report comes out.

I have read the Windward guides and i came up with below 3 possible syntaxs to achieve this, however the report comes blank. Can someone please help me with the right syntax?

--1.
<wr:forEach select="select * from Northwind..Employees" datasource="WWdt2">
<wr:out select ="select * from Northwind..Employees" datasource="WWdt2"/>
</wr:forEach>

--2.
<wr:forEach select="select * from Northwind..Employees" var="temp_OctMN" >
<wr:out value="${ temp_OctMN.EmployeeID} " />
</wr:forEach>

--3.
<wr:forEach select="select * from Northwind..Employees" var=" temp_OctMN" >
<wr:out select="select * from Northwind..Employees where value="${ temp_OctMN.EmployeeID} " />
</wr:forEach>

I am using the Northwind database or use can any table to retrieve all the records. Thank you in advance.

 
New Post 1/23/2008 5:43 PM
  rfligg
43 posts
7th Level Poster


Re: Syntax to retrieve all the records from a table  

You syntax looks incorrect in the way you are referencing tables.

Northwind..Employees should be Northwind.Employees with 1 period as a separator.

--Ryan

 
New Post 1/23/2008 5:44 PM
  rfligg
43 posts
7th Level Poster


Re: Syntax to retrieve all the records from a table  

I have looked at your code in our test environment and it turns out that it works with the two periods in the table/row declaration, IE Northwind..Employees.

Example 2 is the correct way to do what you want. I noticed you have named your datasource. You should only name your datasource if you have 2 or more. Otherwise Windward Reports will select the first datasource by default.

If you are running this from the Java Engine by way of command line, then you may not be declaring your datasource name.

Here is an example of how you should run an rtf template with a named data source on the command line.

From Sample16 in the samples directory for the Java Engine

----------Sample 16 run_java.bat-----------
echo off

if "%2" == "" goto skipSql
echo Running Sql Server examples. Make sure SqlServer jdbc driver jar files are in your classpath.

java net.windward.xmlreport.RunReport "Two Data Sources.rtf" "Report - Two Data Sources.rtf" -xml: xml "Invoice Complex Data.xml" username=%1 password=%2 -sql:northwind "//localhost:1433;DatabaseName=Northwind"
goto end

:skipSql
echo Sql Server examples not being run (call "run username password" to run Sql Server examples).

:end
echo all reports generated.
-----------End Sample 16 run_java.bat---------------

This .bat file takes 2 arguments on the command line

PROMPT> run_java.bat SQLDB_USERNAME SQLDB_PASSWORD


--Ryan

 
New Post 1/23/2008 5:44 PM
  rfligg
43 posts
7th Level Poster


Re: Syntax to retrieve all the records from a table  

Here is the correct format for your example 2:

--2.
<wr:forEach select="select * from Northwind..Employees" var="temp_OctMN" datasource="WWdt2">
<wr:out value="${temp_OctMN.EmployeeID}" datasource="WWdt2"/>
</wr:forEach>

When you specify a datasource you must reference it in each tag you use, otherwise the Windward Reports Engine will not know which one to access the data from.

--Ryan

 
Previous Previous
 
Next Next
  Forum  Templates  Tags & Template...   Syntax to retrieve all the records from a table
Membership Membership:
Latest New User Latest: GrahamA
New Today New Today: 0
New Yesterday New Yesterday: 0
User Count Overall: 56

People Online People Online:
Visitors Visitors: 1
Members Members: 0
Total Total: 1

Online Now Online Now:
All contents copyright (c) 2002 - 2008 by Windward Studios, Inc. All Rights Reserved.   Terms Of Use  Privacy Statement