Welcome Guest Search | Active Topics | Members | Log In | Register

WDMF WHERE clauses Options · View
reidLinden
Posted: Thursday, February 03, 2011 1:00:16 PM
Rank: Apprentice Coder
Groups: Member

Joined: 2/3/2010
Posts: 58
Points: 156
Location: MN
Hallo!

So, I'm looking for a way to do filtering at the outbound level. For example:

Get me all contact records who have NO email
Get me all contact records who have a name that starts with A
Get me all orders placed between date1 and date 2

In SQL, these queries are all very trivial, but (ignoring the existance of 'findBySQL()' due to the inherent insecurity of string concatenation in query building... ), in weborb, I've yet to find a way that doesn't involve getting the entire recordset, and THEN filtering out the stuff that I don't want.

Clearly, if I've got 10 years of Orders data, and I want to look at the "Orders Placed This Month", I don't want to download 100K records, just to keep 25 !

Please tell me that I've missed something, and that theres a much better way to think about this ?

Thanks!
Mark Piller
Posted: Thursday, February 03, 2011 1:27:33 PM

Rank: Administration
Groups: Administration

Joined: 8/21/2006
Posts: 1,607
Points: 4,082
Location: Frisco, TX
With the build available today, the best way to go about this is to create a custom server-side method in a corresponding datamapper class and invoke the method from AS using the following:

ActiveRecords.TableName.YourCustomMethod()

Where TabeName is the name of the data mapper where you added your code.

Regards,
Mark

Mark Piller
Midnight Coders, Inc.
twitter: midnightcoder
blog: blog.themidnightcoders.com
website: www.themidnightcoders.com
reidLinden
Posted: Thursday, February 03, 2011 2:25:48 PM
Rank: Apprentice Coder
Groups: Member

Joined: 2/3/2010
Posts: 58
Points: 156
Location: MN
Thanks Mark,

That wasn't really what I wanted to hear, but its a solution, at least.

Can you tell me, and if so, point me at some documentation, that explains how to use the connection strings data, in a seperate DLL project, IE, not a custom function in the WDMF layer, but, in a Remoting 'service' capacity.

Here's what I'm looking to do. Say I've got the SQL to do a lookup as I've described earlier:

"SELECT * FROM CONTACT WHERE EMAIL <> '' "
"SELECT * FROM CONTACT WHERE NAME LIKE '?%' "
"SELECT * FROM ORDER WHERE DT >= ? AND DT <= ? "

I do NOT need to tie these items back to a table VO type, I just need a simple object array.

I can write the .NET code to take a sql string, and an array of 'parameters', use that to build a parameterized query, execute that, and then return to flex the simple object array version of my data.

I think it would be easiest to write this code outside of the Generated WDMF code, but, I'm not sure if I have access to the WDMF's database connection from there.

Can you advise on the best way for me to proceed with this idea?
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v4.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.083 seconds.