Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    F-Script Qualifiers on tables at two levels in one report
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
I am working on a report of selected Contacts who play one particular role in their Organizations.

Contact data is set on my primary table and my script for selecting the contacts associated with the particular role is working fine. I set Role as the data on the nested table using a Key Path Filter as illustrated in materials from MarketCircle. This works fine as well.

However, as expected, the Key Path Filter returns a table row for each role associated with each Contact that meets the Contact selection criterion. Specifically, my qualifer for Contacts selects a record if it has the role of "Ad Buyer." (I sell advertising.) If that Contact also has the role of "Executive" the Key Path Filter will provide a row for Ad Buyer and for Executive.

Now I want to filter out all Roles except Ad Buyer. I assume that I need to set a selection filter on the Roles table but I'm already using the Key Path Filter to fetch the data. What should I do now?

Can I add a script filter to the Key Path filter or vice versa? Can I specify the Key Path in a script filter?

Thanks!

Bob
 
Posts: 25 | Location: Illinois | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
AJ
Marketcircle Team
Picture of AJ
Posted Hide Post
You can use a script filter in the nested table. I think I'm following you, but it's a little hazy.

I'm assuming that the parent is a table with contacts. Each row has a contact and each contact has roles.

--------------
"Get the contact from the parent row"
contact := element valueForKeyPath:'parent.reportData.object'.
roles := contact roles.

c := roles count.
i := 0.

"Create another array to put the matching roles in"
filteredRoles := NSMutableArray arrayWithCapacity:c.

[i < c] whileTrue:
[
    role := roles objectAtIndex:i.
    role_name := role valueForKeyPath:'roleType.name'.

    (role_name isEqualToString:'Ad Buyer') ifTrue:
    [
      filteredRoles addObject:role.
    ].

    "Increment the counter"
    i := i + 1.
].

"Return the filtered roles"
filteredRoles.

 
Posts: 890 | Location: Toronto | Registered: May 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Thanks, AJ! I put the script into the data specification for the nested table and the results in the sample report were "no data." I have included links to the report specification and script windows below. What have I done wrong? Thanks again!

My test files
 
Posts: 25 | Location: Illinois | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
AJ
Marketcircle Team
Picture of AJ
Posted Hide Post
Yikes - I didn't realized you responded.
I tried downloading the files - but I have no way to uncompress hqx's - can you just zip, dmg or tar them please.

Thanks.
 
Posts: 890 | Location: Toronto | Registered: May 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Hi, AJ. Those files are jpegs. They are just screen caps. If you like, I can email them to you directly. Thanks, again.

Bob
 
Posts: 25 | Location: Illinois | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
AJ
Marketcircle Team
Picture of AJ
Posted Hide Post
sure - or send the report and script file directly - that be more productive than looking at a screencap.
 
Posts: 890 | Location: Toronto | Registered: May 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    F-Script Qualifiers on tables at two levels in one report

© Copyright 2006 Marketcircle Inc. All rights reserved.