Forums
Extending Daylite
Building Reports and Print Layouts
Selected Contact w/ f-script|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Apprentice |
I'm building a report and would like to access the selected contact via f-script. Is there a way to do this?
-- andrew |
||
|
|
Apprentice |
OK. No responses yet. Here's what I've found searching the forums. You can reference the last selected object using this code:
objects := (document firstMainWindowController) selectedObjects. object := objects lastObject. objectName := object name. sys log: objectName. However, when this is run through the report engine, it fails. That is to say that it can be run successfully as a Daylite script (.dlscript) but not via the report engine. The Console log prints this: 5/21/08 10:37:56 PM Daylite[3098] Report Script execution error -- stack follows: ( ) error: undefined identifier "document" objects := (document firstMainWindowController) selectedObjects. object := objects lastObject. studentName := object name. sys log: studentName. So, my thoughts are that the reference to "document firstMainWindowController" is where the problem lies. Any thoughts? -- andrew |
|||
|
|
Apprentice |
Alright. I think I've solved this and wanted to post in case it would help anyone else. The reference to "document firstMainWindowController) was the problem. You must first reference the Daylite document.
document := (NSApplication sharedApplication) firstDayliteDocument. objects := (document firstMainWindowController) selectedObjects. object := objects lastObject. contactName := object name. repData := element reportData. repData setObject:contactName forKey:'selectedContact'. This code is run as a pre-extraction script on the report. The last two lines store a reference to the value in the reportData element with the key 'selectedContact'. You are then able to pull this information into reports dynamically using the following snippet. (element enclosingReportLayout) valueForKeyPath: 'reportData.selectedContact'. For what it's worth. Obviously, the user should have a contact selected in the source list before running this report. -- andrew |
|||
|
|
Marketcircle Team |
Why not use a print layout?
|
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Forums
Extending Daylite
Building Reports and Print Layouts
Selected Contact w/ f-script
