Ken, David,
You may be pleased to note that I am now using the fetch
specification ... however,
is there a workaround for the term "SYSDATE" ? It seems my
EOModeler doesn't like the
keyword:
Here is my error returned:
sqlStringForKeyComparisonQualifier: attempt to generate SQL for
com.webobjects.eocontrol.EOKeyComparisonQualifier
($SYSDATE >=
warrantyExpDate) failed because attribute identified by key '$SYSDATE'
was not reachable from from entity 'Server'
although it works at the SQL prompt. I tried to define NSTimestamp
as $SYSDATE, but
that did not work either. What should I use?
Thanks so much for helping me! I really appreciate it a lot!!
Janice
Ken Anderson wrote:
Janice,
I use ReportMill directly with objects - if you need something inside
your object, you can use keypaths, like:
@myobject.myvalue@
Ken
On Oct 6, 2005, at 11:56 AM, Janice Cheung wrote:
Hi David,
The reason why I have to use raw rows is for creating PDF reports
using ReportMill, which takes the raw sql
keys and data (DNS_NAME, MODEL, etc) and outputs into an XML file,
returning nicely into defined report
templates.
I can access the objects as m_strDvDepts.VENDOR,
m_strDvDepts.DNS_NAME, m_strDvDepts.MODEL, etc..
but these appear as an array (ie,
("IBM","IBM","IBM","IBM","IBM","IBM","IBM")) rather than in a table-
like
structure from a WORepetition.
Is there any way around rendering my WORepetition using the raw
rows rather than creating a fetch spec?
I checked the item binding, and no matter how many permutations of
"server" to item, and "m_strDvDepts"
to list, I can't seem to get my data outputted properly, although
my data is appearing in a horrifically messy array.
Thanks again for trying to help me and for your insightful advice..
Best regards,
Janice
David LeBer wrote:
On 6-Oct-05, at 10:38 AM, Janice Cheung
wrote:
Greetings!
How do I format my array of raw rows of SQL results using a
formatter in a WORepetition?
Here is my function:
public void fetchSixtyEx()
{
Session s = ((Session)session());
String sql = new String("select distinct DNS_NAME,
WARRANTY_EXP_DATE, MODEL_TYPE, WARRANTY_TYPE, IP, VENDOR, MODEL,
TAG, SERIAL_NUMBER from
server_mgmt_db.SERVER,a_db.V_DEVICE");
sql += " where SERVER.DEVICE_FK = V_DEVICE.DEVICE_ID";
sql += " and SERVER.WARRANTY_EXP_DATE < SYSDATE+60 and
SERVER.WARRANTY_EXP_DATE>=SYSDATE";
NSArray results = EOUtilities.rawRowsForSQL(session
().defaultEditingContext(), "server_mgmt", sql);
setM_strDvDepts((NSArray) results);
}
This is my error:
Error: java.lang.IllegalArgumentException: While trying to set
the field "server" on an object of type ViewServerReport we expected
a
Server but received a com.webobjects.foundation.NSMutableDictionary
with a value of {MODEL_TYPE = "eServer x335"; DNS_NAME = "N114";
WARRANTY_EXP_DATE = 2006-06-15 04:00:00 Etc/GMT; SERIAL_NUMBER =
"ABCDE"; IP = "123.456.78.106"; VENDOR = "IBM"; MODEL = "xSeries 335
Intel Xeon"; TAG = "111423"; WARRANTY_TYPE = "24x7x4"; }.
This often happens if you forget to use a formatter.
However, I am using a formatter - well .. I am using a
WORepetition, with list attribute defined with a "m_strDvDepts"
binding,
and item attribute with a "server" binding. In this repetition,
I am trying to retrieve string "server.dnsAlias". I tried putting in
string "DNS_ALIAS" (as retrieved from the sql query) but to no
avail. How can I get my WORepetition to properly format the results
of
my SQL query? How do I get the object keys for DNS_NAME,
WARRANTY_EXP_DATE, MODEL_TYPE, WARRANTY_TYPE, VENDOR,
MODEL, TAG, SERIAL_NUMBER to be displayed?
Thank you for helping me. Any advice and guidance is greatly
appreciated!
Best regards,
Janice
Well...
First I am going to assume you have a *very* good reason for using
raw rows at this point rather than just creating a fetch spec and
doing this the 'WebO way', cause from the complexity of your fetch I
cannot see it.
Secondly...
EOUtilities.rawRowsForSQL(ec, modelName, sqlstring) is deprecated.
You should use:
EOUtilities.rawRowsForSQL(EOEditingContext ec,
String modelName,
String sqlString,
NSArray keys)
The NSArray of keys allows you to specify the attribute keys in the
dictionaries returned by your fetch.
Thirdly...
The error is telling you it is not receiving a Server object when it
expects to, rather it is receiving an NSMutableDictionary. Which is
what you get when you do a raw rows fetch (an array of dictionaries).
Check the item binding for your repetition. I bet it is a Server
object.
Fourthly...
No, really, do this with a fetch spec... That'll give you Objects,
which is the Objects part of Web*Objects*. It'll make your life MUCH
easier.
--
;david
--
David LeBer
"I am codeferous!"
Codeferous Software
site: http://www.codeferous.com
blog: http://david.codeferous.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
|