Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Building Reports and Print Layouts    Getting data from a relationship
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Mec
Apprentice
Posted
Hi All

I am trying to build a report based on opportunities, I would like to get a specific contact based on their relationship to the opportunity, but I am struggling to find a good method to achieve this.

I have an array of all the contacts linked to the opportunity, but I have no idea how to only show the contact in the specific relationship I am interested in.

Can anyone point me in the right direction?

Thanks

Meyric
 
Posts: 9 | Location: UK | Registered: April 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Mec
Apprentice
Posted Hide Post
Hi All

So I have managed to solve this.

You can run a f-script to prodcue dynamic text, I cobbled together a script to iterate through my array of contacts and pull out the relevant ones.

I actually used opportunities 'Contact Roles' to find the contact in a specified role.

Script is here if you need a starting point:

"get all roles for an opportunity"
roles := element valueForKeyPath:'parent.reportData.object.contactRoles'.
"set up a loop"
rolesCount := roles count.
i := 0.
"for every role check what the role is and if it is the right one, set the value of keyPerson"
keyPerson := 'None Specified'.
[ i < rolesCount ] whileTrue:
[
role := roles objectAtIndex:i.
roleName := role valueForKeyPath:'roleType.name'.
( roleName isEqualToString:'string of role' ) ifTrue:
[
keyPerson := role valueForKeyPath:'contact.name'.
].
i := i + 1.
].
"return the value"
keyPerson.


Mec
 
Posts: 9 | Location: UK | Registered: April 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Oscar
Posted Hide Post
Thank you for the forum and script contribution Mec.

We really appreciate it.
 
Posts: 505 | Location: Toronto | Registered: February 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Picture of John Webb
Posted Hide Post
Thanks for posting this. I'm able to get it to work, sort of. It will only display one contact from the list. I'm expecting it to display all of the contacts that match the criteria. So if I have three contacts that match the criteria, I want it to display all three contacts, not just the first one in the list. I've banged my head against this for over two hours, but can't seem to make any progress. I have been able to verify the script is getting all of the roles for an opportunity, so I know that part is working. Any help on this would be greatly appreciated. Thanks!
 
Posts: 6 | Location: Tallahassee, FL | Registered: July 25, 2006Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Sorry for the nOOb question but how can I put this script in the dynamic text box to generate the result?

I can't seem to generate the script tag that I have seen in other reports and just pasting in the text doesn't work smile
 
Posts: 9 | Registered: April 04, 2007Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Right so you just have to look a little harder in the dynamic text box window! smile

Anyway I got the script tag and pasted in the script but I get this error when i try to run the report: any thoughts?

The Block Inspector returns
this error

[ i < rolesCount ]

error: argument 1 of method "<" is nil, an instance of NSNumber was expected
 
Posts: 9 | Registered: April 04, 2007Reply 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  Building Reports and Print Layouts    Getting data from a relationship

© Copyright 2006 Marketcircle Inc. All rights reserved.