RE: how do i say that in EOModeler
RE: how do i say that in EOModeler
- Subject: RE: how do i say that in EOModeler
- From: "Jonathan Fleming" <email@hidden>
- Date: Fri, 30 Jul 2004 06:03:55 +0100
// Your Class for use with directAction methods
// You can do this in EOModel if you wish but, however,
// I have done it programmatically here for more flexibility later if needed
// I have not tested this but I hope it will help
// Regards
// Jonathan :^)
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class YourClass extends WOComponent {
protected String text2Find, tabtext2Find;
/** @TypeInfo com.webobjects.eocontrol.Tab */
protected NSArray tabList;
/** @TypeInfo Tab */
protected NSDictionary tab;
protected boolean foundResults;
protected boolean showDetails;
protected boolean noResults=false;
// constructor
public YourClass(WOContext context) {
super(context);
}
// This is where we do our intitial search
public WOComponent lookUpTab() {
String text2Find = "*";
if ( tab != null ) {
text2Find = "*"+tabText2Find+"*";
}
/*------------- end local variables & start qualifier bindings
-------------*/
NSArray bindings = new NSArray( new Object [] { text2Find } );
EOQualifier qualifier =
EOQualifier.qualifierWithQualifierFormat("krit like %@",
bindings );
NSMutableArray qualifierArray = new NSMutableArray();
qualifierArray.addObject(qualifier);
// omits keyValueCoding null values
NSArray args = new NSArray(new Object[]
{NSKeyValueCoding.NullValue});
EOQualifier qualifier2 =
EOQualifier.qualifierWithQualifierFormat("krit != %@", args);
qualifierArray.addObject(qualifier2);
EOAndQualifier quals = new EOAndQualifier(qualifierArray);
/*------------- end qualifier statements & start sort orderings
-------------*/
EOSortOrdering kritSortOrdering =
EOSortOrdering.sortOrderingWithKey("krit",
EOSortOrdering.CompareAscending);
/*
* secondary sort if needed
*
EOSortOrdering otherSortOrdering =
EOSortOrdering.sortOrderingWithKey("other",
EOSortOrdering.CompareAscending);
*/
NSArray sortOrderings =
new NSArray( new Object[]{kritSortOrdering /*,
otherSortOrdering*/});
/*------------- end sort orderings & start fetch spec
-------------*/
EOFetchSpecification fetchSpec = new EOFetchSpecification("Tab",
quals, sortOrderings);
fetchSpec.setFetchesRawRows( true );
NSArray keyPaths = new NSArray( new String [] {
"tabID",
"krit"
/*"other"*/} );
fetchSpec.setRawRowKeyPaths( keyPaths );
EOEditingContext ec = this.session().defaultEditingContext();
tabList = ec.objectsWithFetchSpecification(fetchSpec);
if (tabList.count() ==0) {
noResults = true;
foundResults = false;
} else {
noResults = false;
foundResults = true;
}
showDetails = false;
return null;
}
}
From: "Sako!" <email@hidden>
To: <email@hidden>
CC: "omni group" <email@hidden>
Subject: how do i say that in EOModeler
Date: Thu, 29 Jul 2004 17:04:15 +0200
hi,
i have a table TAB, includes Column Krit from kind Text in my MS-SQL.
------------------------------------------
i want to search the rows who include the text "Sent EMail". i do this :
SELECT T1.Krit
FROM TAB T1
WHERE T1.Krit like '%Sent EMail%'
------------------------------------------
and if i want to search the rows which dont include the text"Sent EMail". i
do this:
SELECT T1.Krit
FROM TAB T1
WHERE T1.Krit not like '%Sent EMail%'
------------------------------------------
both sql work.
now my question how do i say that in EOModeler?
i tried with (krit like '%Sent EMail%') in a Fetch but id didnt work.
regards
Sako.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.