If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

[Script] Some javascripts in actions

Started by sir_jeroen, 05 Oct 2005 05:06:12 AM

Previous topic - Next topic

sir_jeroen

Show your reports!!



I'll start off:

Look in my tutorials section and click on "ReportNet extended"....
http://www.jeroendegraaff.nl/cognoise


Upload your movies/screen dumps etc...

Let me know what you think

davidsoc

 :o OK... tell me how you did that world map!  :o

It's very impressive! All done with sdk or script?

sir_jeroen

No sdk used at all... only javascript... :D
Took some time... but got it finally working....

Tnx for the compliment...

CoginAustin

I actually did the same thing with google maps. Our outside sales reps can pull their address list, click on one and it open google maps in an iframe to show them where it is located :)

sir_jeroen


CoginAustin

I dont have the ability to record anything but here is the XML , just to prove it..


<report xml:lang="en-us" xmlns="http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->
<layoutList>
<layout>

<pageSet>

<page name="Page1">
<pageBody><table><tableRow><tableCell><textItem><text>North American Sales Team by City</text><style><stringFormat/><CSS value="font-size:16pt;font-weight:bold;color:navy"/></style></textItem><style><CSS value="padding-bottom:15px"/></style></tableCell><tableCell/></tableRow><tableRow><tableCell>

<selectValue refQuery="Query2" required="false" selectUI="dropdown" parameter="pCity" autoSubmit="true" multiSelect="false"><useItem refItem="City"/><displayItem refItem="City1"/><defaultSelections><defaultSelection>Boston</defaultSelection></defaultSelections></selectValue>
<style><CSS value="text-align:left;vertical-align:top"/></style></tableCell><tableCell/><style><CSS value="text-align:left"/></style></tableRow><tableRow><tableCell>
<style><CSS value="vertical-align:top;text-align:left;padding-bottom:15px"/></style><table><tableRow><tableCell><list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef content="label" refItem="Country"/></textItem></listColumnTitle><listColumnTitle><textItem><text>National Flag</text></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="City"/></textItem></listColumnTitle><listColumnTitle><textItem><text>Postal / Zip Code</text></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn refLevel="Country"><textItem><queryItemRef refItem="Country"/></textItem></listColumn><listColumn refLevel="Flag image"><image><queryItemRef refItem="Flag image"/><style><CSS value="width:40px;height:20px"/></style></image></listColumn><listColumn refLevel="City"><textItem><queryItemRef refItem="City"/></textItem></listColumn><listColumn refLevel="Postal zone"><textItem><queryItemRef refItem="Postal zone"/></textItem></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Country|Flag image|City|Postal zone|Address line 1"/></list></tableCell></tableRow><tableRow><tableCell><table><tableRow><tableCell>
<table><tableRow><tableCell><list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><text>Office Street Address</text></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn refLevel="Address line 1"><textItem><queryItemRef refItem="Address line 1"/></textItem></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse;margin-top:10px"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Country|Flag image|City|Postal zone|Address line 1"/></list></tableCell><tableCell>
<style><CSS value="vertical-align:top;text-align:left;padding-top:10px"/></style><button>
<textItem>
<text>Office Location</text></textItem>
<expression>[Street Address]</expression></button>
</tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></tableCell></tableRow><tableRow><tableCell><list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef refItem="City1"/></textItem><textItem><text> Staff Members</text></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn><textItem><queryItemRef refItem="Staff name"/></textItem></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse;vertical-align:text-top;text-align:left;margin-top:10px"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Country|Flag image|City|Postal zone|Address line 1"/></list></tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></tableCell><tableCell>
<style><CSS value="vertical-align:top;text-align:left"/></style><HTMLItem>
<expression>[Iframe Generator]</expression></HTMLItem>
</tableCell></tableRow><tableRow><tableCell><table><tableRow><tableCell>
<block/>
</tableCell></tableRow><tableRow><tableCell/></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></tableCell><tableCell/></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></pageBody>
</page></pageSet></layout>
</layoutList>
<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/><querySet xml:lang="en-us"><BIQuery name="Query1"><cube><factList><dataItem name="Dynamic URL" aggregate="none"><expression>'http://www.google.com/maps?q='|| Trim([Postal zone])</expression></dataItem><dataItem name="Analyze Hyperlink" aggregate="none"><expression>[Dynamic URL]</expression></dataItem><item refItem="Staff name" aggregate="none"/><dataItem name="Iframe Generator" aggregate="none"><expression>'&lt;iframe src="http://www.google.com/maps?q=' || Replace ([Address line 1], ' ', '+') || '+' || Trim([Postal zone])|| Trim('"')|| ' name="SetIFrame" ' || 'style=" width:610px; height:450px" /&gt;&lt;/iframe&gt;'

</expression></dataItem><item refItem="City1" aggregate="none"/><dataItem name="Street Address" aggregate="none"><expression>'http://www.google.com/maps?q=' || Replace([Address line 1],' ','+') || '+' ||Trim([Postal zone])
</expression></dataItem></factList><dimension name="Country"><level name="Country"><item key="true" refItem="Country" aggregate="none"/></level><level name="Flag image"><item key="true" refItem="Flag image" aggregate="none"/></level><level name="City"><item key="true" refItem="City" aggregate="none"/></level><level name="Postal zone"><item key="true" refItem="Postal zone" aggregate="none"/></level><level name="Address line 1"><item key="true" refItem="Address line 1" aggregate="none"/></level></dimension></cube><tabularModel><dataItem name="Postal zone" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[Postal zone]</expression></dataItem><dataItem name="Staff name" aggregate="none"><expression>[gosales_goretailers].[Sales reps].[Staff name]</expression></dataItem><dataItem name="Country" aggregate="none"><expression>[gosales_goretailers].[Countries].[Country]</expression></dataItem><dataItem name="Flag image" aggregate="none"><expression>[gosales_goretailers].[Countries].[Flag image]</expression></dataItem><dataItem name="Address line 1" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[Address line 1]</expression></dataItem><dataItem name="City" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[City]</expression></dataItem><filter use="optional"><condition>[gosales_goretailers].[Sales branch address].[City] = ?pCity?</condition></filter><filter><condition>[gosales_goretailers].[Sales branch address].[Country] in ('Canada', 'Mexico', 'United States')</condition></filter><dataItem name="City1" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[City]</expression></dataItem></tabularModel></BIQuery><BIQuery name="Query2"><cube><factList><item refItem="City" aggregate="none" isHeader="true"/><item refItem="City1" aggregate="none" isHeader="true"/></factList></cube><tabularModel><dataItem name="City" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[City]</expression></dataItem><dataItem name="City1" sort="ascending" aggregate="none"><expression>[gosales_goretailers].[Sales branch address].[City]</expression></dataItem><filter><condition>[gosales_goretailers].[Sales branch address].[Country] in ('Canada', 'Mexico', 'United States')</condition></filter></tabularModel></BIQuery></querySet></report>

CoginAustin

#6
Screenshot attached.. It uses google local because it makes it easier to find things if you can quickly look at whats around it as well :)
This was my inspiration not the final product. You can actually use the above XML and "copy from clipboard" to use it on your Go Sales package. I also must thank Pat Dolinger at Cognos for help with this :)


sir_jeroen

Looks great!!
But ... you pass the address parameters in the url... am I correct?
In my example I use the Google API in my code (yep... it's googlemaps too :) )
Does your code also work with the API?

Anyway looks great!!

CoginAustin

Yes, it gets passed in the URL. I am not sure the API works with google local? I will have to check it out again..

sir_jeroen

yes it does... that's how it works for me :D

JoeBass

RN A, Your clickable map report looks great.  Can you show the source?  Thanks. 

JoeBass

Hi again,  Hope I'm not breaking one of the board rules by bumping this thread. 

I understand that you don't want to share the code behind your clickable map report.  Can you share with me if it is a data-driven map, or are you hard-coding clickable hot spots? 

I work for an expanding company that could benefit from a map like yours - cool idea.

sir_jeroen

you can contact me using msn chat... See my profile for details...

sir_jeroen

and to make you curious: it's data driven :D

JoeBass

My interest is piqued!  I would like to follow up but, I will be away from the PC for some time.  Thank you.

sir_jeroen


jolly

#16
Really good. And here is one of my Reports. Small but helpfull for the Users.. The Event onMouseOver highlited the complete row.

Cu Jolly

sir_jeroen

Wow... that looks great!!

All javascript I suppose?  Btw I'm curious.. How did you do that top bar (that one with Administrator and Report viewer text).... And this is CRN 1.1 MR2 or CRN 8??

jolly

#18
The highliting of the row is written in JavaScript.
Did you mean the Color and the Border from the TopBar? If so, it can be changed in the CSS-Files.

My CRN-Version is: 1.1 MR2

sir_jeroen

Yep that's what I meant... But it still looks awsome!!

jolly

If you want to have these files, inform me.

CoginAustin

I would love to get a copy of them :)

jolly

#22
And here are the CSS files. Please copy your original files and replace them by the new one. I included a readme with instructions where you can find these CSS-Files.

Have fun.

Cu

sir_jeroen

Tnx!!! I'm gonna take a look at them!

JoeBass

#24
This Delphi snippet opens a browser and runs a report with a single parameter that the user chooses in the application.Ã,  The user is required to login to view the report.

//Open IE Code From - http://www.chami.com/tips/delphi/110396D.html
procedure TMainF.OpenInternetExplorer(sURL : string);
const
Ã,  csOLEObjName = 'InternetExplorer.Application';
var
Ã,  IEÃ,  Ã,  Ã,  Ã,  : Variant;
Ã,  WinHandle : HWnd;
begin
Ã,  if( VarIsEmpty( IE ) )then
Ã,  Ã,  begin
Ã,  Ã,  Ã,  IE := CreateOleObject( csOLEObjName );
Ã,  Ã,  Ã,  IE.Visible := true;
Ã,  Ã,  Ã,  IE.Navigate( sURL );
Ã,  Ã,  end
Ã,  else
Ã,  Ã,  begin
Ã,  Ã,  Ã,  WinHandle := FindWIndow( 'IEFrame', nil );
Ã,  Ã,  Ã,  if( 0 <> WinHandle )then
Ã,  Ã,  Ã,  Ã,  begin
Ã,  Ã,  Ã,  Ã,  Ã,  IE.Navigate( sURL );
Ã,  Ã,  Ã,  Ã,  Ã,  SetForegroundWindow( WinHandle );Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  end
Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  begin
Ã,  Ã,  Ã,  Ã,  Ã,  // handle error ...
Ã,  Ã,  Ã,  Ã,  end;
Ã,  Ã,  end;
end;

//Seeds from http://www.tek-tips.com
procedure TMainF.WithVendorMIClick(Sender: TObject);
begin
Ã,  if StartupCB.Text <> '' then
Ã,  Ã,  OpenInternetExplorer('http://www.yourserver.com/crn/cgi-bin/cognos.cgi?' +
Ã,  Ã,     'b_action=xts.run&m=portal/report-viewer.xts&method=' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 'execute&m_obj=%2fcontent%2fpackage%5b%40name%3d%27' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 'YourPackage%27%5d%2freport%5b%40name%3d%27' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 'YourReport%27%5d&backURL=%2fcrn%2fcgi-bin' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, '%2fcognos.cgi%3fb_action%3dxts.run%26m%3dportal%2fcc.' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 'xts%26m_path2%3d~%252ffolder%26m_path%3d%252fcontent%' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, '252fpackage%255b%2540name%253d%2527YourPackage%2527%255d'+
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, '&prompt=false' +
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, '&YourParameterName=' + YourParameterValue);
end;