|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Apprentice |
I have a Group called Adventures Customers and another called Adventures Prospects. I want to select them using F-Script qualifiers. I assume that I need to use something like: "isLike" or "doesContain" (does F-Script have 'doesContain'?).
I've tried several variations on the syntax but I apparently don't know the wildcards or syntax. For example: "qual1 := BDQualifier qualifierWhereValueOfKey:'defaultRole.organization.allGroupsAsString' isLike:'Adventures%." doesn't work. Can someone give me the proper syntax or other direction, please? Thanks! Bob |
||
|
|
Marketcircle Team |
qual := BDKeyValueQualifier keyValueQualifierWithKey:'name' operatorSelector:#isLike: value:'Adventures*'. results := objectContext objectsForEntityNamed:'Group' matchingQualifier:qual. resultsEnum := results objectEnumerator. aResult := resultsEnum nextObject. sys log:(results count). [ aResult ~= nil ] whileTrue: [ sys log:(aResult name). aResult := resultsEnum nextObject. ]. NOTE! check the console to see the output. |
|||
|
|
Marketcircle Team |
Also, for reference...
#isEqualTo: #isNotEqualTo: #isLessThan: #isGreaterThan: #isLessThanOrEqualTo: #isGreaterThanOrEqualTo: #doesContain: #isLike: #isCaseInsensitiveLike: #containsString: #containsCaseInsensitiveString: |
|||
|
|
Apprentice |
Thanks Eric!
Can you tell me where these qualifiers are documented? I searched the F-Script Guide and couldn't find them. Also, is there any way to select a Contact or Organization by specifying part of the key "allGroupsAsString"? For example, my script qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'. qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'. qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*'. qualifiers := {qual1,qual2,qual3}. andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease). objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual. will return data rows for every record that qual1 and qual2 select, and the resulting table has a column for allGroupsAsString in which some of the records showing the groups Personal Contact and Professional Contact. This is what I expect. However when I modify the script as follows, I get No Data. qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'. qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'. qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*Personal*'. qualifiers := {qual1,qual2,qual3}. andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease). objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual. I've tried every variation of wildcard I can think of and nothing except * returns any data. Can you help? Thanks again! Bob |
|||
|
|
Marketcircle Team |
Try something like this...
qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'.
qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'.
qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*Personal*'.
qualifiers := {qual1,qual2}.
andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease).
results := objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual.
results2 := results filteredArrayUsingQualifier:qual3.
sys log:(results count).
sys log:(results2 count).
resultsEnum := results2 objectEnumerator.
aResult := resultsEnum nextObject.
[ aResult ~= nil ] whileTrue:
[
sys log: aResult firstname.
sys log: aResult allGroupsAsString.
aResult := resultsEnum nextObject.
].
------------- The reason it wasn't returning anything when you had all 3 qualifiers in the And qual was because 'allGroupsAsString' is a derived attribute on the object and does not exist in the database. In the above, we're faulting all of the objects into memory (in the with the objectsForEntityNamed:matchingQualifier |
|||
|
|
Apprentice |
Thanks, Eric! Here is where I am at this point.
The following script still works. I assume this is because I am specifying s total wild card for the value of allGroupsAsString. This is how it looks in the data fetcher script editor. qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'. qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'. qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*'. qualifiers := {qual1,qual2,qual3}. andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease). objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual. The Result Name is: Contacts. The Kind is: Contact This is what the results look like: My Report Firstname Default Role Name Contact Groups As String Bob Participant Personal Contact Bob Participant Robert Participant Personal Contact Robert Participant Professional Contact Robert Participant Personal Vendor Roberta Participant Personal Contact When I substitute your code, as follows, and run the report, I get No Data. <pre class="ip-ubbcode-code-pre"> qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'. qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'. qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*Personal*'. qualifiers := {qual1,qual2}. andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease). results := objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual. results2 := results filteredArrayUsingQualifier:qual3. sys log sys log resultsEnum := results2 objectEnumerator. aResult := resultsEnum nextObject. [ aResult ~= nil ] whileTrue: [ sys log: aResult firstname. sys log: aResult allGroupsAsString. aResult := resultsEnum nextObject. ]. </pre> What next... and thanks for the awesome assistance! Bob |
|||
|
|
Marketcircle Team |
I took the sample data which you provided and entered it into a database. I then ran the following script below... the output was..
Output: 2006-07-27 21:54:01.451 Daylite[334] 9 2006-07-27 21:54:01.451 Daylite[334] 4 2006-07-27 21:54:01.453 Daylite[334] Bob 2006-07-27 21:54:01.453 Daylite[334] Personal Contact 2006-07-27 21:54:01.453 Daylite[334] Robert 2006-07-27 21:54:01.453 Daylite[334] Personal Contact 2006-07-27 21:54:01.453 Daylite[334] Robert 2006-07-27 21:54:01.453 Daylite[334] Personal Vendor 2006-07-27 21:54:01.453 Daylite[334] Roberta 2006-07-27 21:54:01.453 Daylite[334] Personal Contact which is correct. The only thing I can think of is that maybe you need caseInsensitiveLike.. ie. your groups are named 'personal' rather than 'Personal'. Other than that I'm baffled. Try pasting the code below into a new file and running it...
qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'.
qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'.
qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*Personal*'.
qualifiers := {qual1,qual2}.
andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease).
results := objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual.
results2 := results filteredArrayUsingQualifier:qual3.
sys log:(results count).
sys log:(results2 count).
resultsEnum := results2 objectEnumerator.
aResult := resultsEnum nextObject.
[ aResult ~= nil ] whileTrue:
[
sys log: aResult firstname.
sys log: aResult allGroupsAsString.
aResult := resultsEnum nextObject.
].
|
|||
|
|
Apprentice |
Eric,
Thanks for working diligently (and late) to help. However... same result: No Data. May I send you the .dlreport file to look at? Bob |
|||
|
|
Marketcircle Team |
Ah this is a report...
Try inserting this instead...
qual1 := BDQualifier qualifierWhereValueOfKey:'firstname' isLike:'*ob*'.
qual2 := BDQualifier qualifierWhereValueOfKey:'defaultRole.roleType.name' isLike:'Participant'.
qual3 := BDQualifier qualifierWhereValueOfKey:'allGroupsAsString' isLike:'*Personal*'.
qualifiers := {qual1,qual2}.
andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease).
results := objectContext objectsForEntityNamed:'Contact' matchingQualifier:andQual.
results filteredArrayUsingQualifier:qual3.
|
|||
|
|
Apprentice |
Thanks again, Eric. This seems to work so I am further down the trail!
Couple of related questions: 1. Where would the code you originally gave me be typically used? 2. Where are the testing methods (doesContain, IsEqualTo, and so forth) documented? I couldn't find them in the F-Script Guide. Bob |
|||
|
|
Marketcircle Team |
In a Daylite script (.dlscript). You can create it and then drag it on the Daylite icon or double click the dlscript and Daylite will run it. (ie. script daylite)
You can find these in the Daylite Developer Kit in the following files.. file://DayliteDeveloperKit3/Qualifiers/Documentation/Classes/BDQualifier.html and Qualifiers/Source/BDQualifier.h |
|||
|
|
Apprentice |
Hi:
I'm trying to use the "doesContain" or "containsString" or "doesnotcontain" qualifier. However, it does not work out. The console shows e.g.: error: the class object BDQualifier does not respond to "qualifierWhereValueOfKey:doesContain:" I'm using the qualifier in the following f-script (in a report): qual1 := BDQualifier qualifierWhereValueOfKey:'tasks.category.name' isLike:'*Anruf*'. qual2 := BDQualifier qualifierWhereValueOfKey:'tasks.contacts.cachedName' doesContain: '*'. qualifiers := {qual1, qual2}. andQual := (((BDAndQualifier alloc) initWithQualifierArray:qualifiers) autorelease). objectContext objectsForEntityNamed:'Organization' matchingQualifier:andQual. Could someone tell me why the "doesContain" qualifier does not work? Denis. |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

