Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link SQL Related Articles: Using same file structure to retrieve multiple fields 2002-07-08 -- Andy Stapleton Newsgroups: TopSpeed.Products.Drivers
Sure......
Definition of the RESULTTABLE in SQL
Create Table ResultTable
Integer1 integer
String1 Varchar(255),
Date1 Date,
Decimal1 Decimal(12,2));
Clarion DCT definition
ResultTable FILE,PRe(Res),Driver(ODBC),NAME(DBO.ResultTable)
Integer1 Long
Integer2 Long,NAME(INteger1)
Integer3 Long,NAME(INtege1)
Integer4 Long,NAME(INteger1)
Integer5 Long,NAME(INteger1)
String1 String(255)
String2 String(255),NAME(String1)
String3 String(255),NAME(String1)
String4 String(255),NAME(String1)
String5 String(255),NAME(String1)
Date1 Date
Date2 Date,NAME(DATE1)
Date3 Date,NAME(DATE1)
Date4 Date,NAME(DATE1)
Date5 Date,NAME(DATE1)
Decimal1 Decimal(12,2)
Decimal2 Decimal(12,2),NAME(Decimal1)
Decimal3 Decimal(12,2),NAME(Decimal1)
Decimal4 Decimal(12,2),NAME(Decimal1)
Decimal5 Decimal(12,2),NAME(Decimal1)
END
IN my CW Code.....
myResults VIEW(ResultTable)
Project(Res:String1)
Project(Res:String2)
Project(Res:String3)
Project(Res:Date1)
Project(Res:Decimal1)
END
Open(MyResults)
if Errorcode();Stop(Error()).
MyResults{Prop:Sql}='Select ord.OrderNo, Cus.CompanyName,
Cus.ContactNAme, Ord.Orderdate, Ord.Amount '&|
' From '&NAME(Orders)&' as
ORD,'&NAME(Customer)&' as Cus '&|
' Where Ord.CustSysid = Cus.custSysid ' &|
' And Ord.Orderdate Between
<39>'&Format(Loc:Startdate,@d10-)&'<39> and <39>'&|
Format(Loc:EndDate,@d10-)&'<39>'
If Errorcode();Stop(FileError()).
Loop
Next(MyResults)
IF Errorcode();Break.
do something with the records, print, or whatever.
END !Loop
Now I did make the above a bit more involved for a reason, this will give a
good report for a customer order by date, also you can see how to do a date
range using local variables as well... this does a inner join on the
customer / order file.
--
Andy <
Today is November 23, 2024, 2:12 am This article has been viewed 35216 times. Google search has resulted in 35 hits on this article since January 25, 2004.
|
|