Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does InvokeURL work in Flexible/Fusion layouts?

6 REPLIES 6
Reply
Message 1 of 7
emluv
927 Views, 6 Replies

Does InvokeURL work in Flexible/Fusion layouts?

Hello,
I have been successful in a simple web layout passing a selection to an InvokeURL which pulls a report for the selected features in MG Enterprise 2010. However, when I try to exact same thing in a fusion layout, I get an error reading there is an Unclassified Exception. Has anyone been able to InvokeURL's in Fusion and if so, what am I missing? Please help:)
Thanks!!
emluv
6 REPLIES 6
Message 2 of 7
gluckett
in reply to: emluv

Hi, the InvokeURL works but the $CurrentSelection is not passed. You will have to determine what is selected by using the MAPNAME and SESSION this is passed. I would recommend passing some other items such as the real key name and the layername you are reporting on.

In your report you can get what is selected on the server:

$featureReader = $sel->GetSelectedFeatures($selLayer, $featureClassName, true);

once you have te featureReader, just loop over to get the real Keys etc.

gordon
Message 3 of 7
emluv
in reply to: emluv

Thanks for replying to my question. Sorry, I am a newbie and still a bit lost.
When you say I will have to determine what is selected using the MAPNAME and SESSION, where do I do this?
Also would I replace
$featureReader = $sel->GetSelectedFeatures($selLayer, $featureClassName, true);
with what is already in the script, or add it in addition to?


Thanks!
emluv
Message 4 of 7
gluckett
in reply to: emluv

Once you have the MapName and Session that is automatically passed by mapguide to whatever URL you enter:
$configFilePath = "C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\webconfig.ini";

$session = urldecode(($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['SESSION']: $_GET['SESSION']);
$mapName = urldecode(($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['MAPNAME']: $_GET['MAPNAME']);

MgInitializeWebTier ($configFilePath);

$userInfo = new MgUserInformation($session);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);

//Once you have the siteconnection - open the resource service:

$resourceSrvc = $siteConnection->CreateService(0);

//using the MapName sent from mapguide get all the layers in your map

$map = new MgMap($siteConnection);
$map->Open($resourceSrvc, $mapName);

$sel = new MgSelection($map);

$sel->Open($resourceSrvc, $mapName);

$selLayers = $sel->GetLayers();

//Loop over the layers and get the correct layer that you want to select from:

for($li = 0; $li GetCount(); $li++)
{

$selLayer = $selLayers->GetItem($li);

$featureClassName = $selLayer->GetFeatureClassName();
$featureReader = $sel->GetSelectedFeatures($selLayer, $featureClassName, true);

if($selLayer->GetName() == "Parcels")
{


//LOOP OVER EACH FEATURE
while($featureReader->ReadNext())
{
$objkeys .= $featureReader->GetDouble("PARCEL_ID");
}
$featureReader->Close();
}
//YOU CAN NOW DO WHATEVER YOU WANT WITH THE LIST OF PARCEL_IDS
echo "<SCRIPT language=javascript>alert('" . $objkeys . "')</SCRIPT>";
}



The GETDOUBLE works if your "PARCEL_ID" are doubles...you would have to use getString or GetInt32 etc if it is something else.


regards

gordon
Message 5 of 7
emluv
in reply to: emluv

Thanks again. I am sorry but I forgot to mention that I am using the InvokeReport script found in the Dev. Sample. It has most of the code you provided. I have attached the InvokeReport script that I am using and below are the parameters I am passing in Studio. What am I missing?

URL to invoke:
../../../../map_gis/InvokeReport.php

URL http://127.0.0.1/map_search/report_survey.cfm
KEY Document_N
LAYER Surveys
SEL $CurrentSelection

Thanks!
emluv
Message 6 of 7
gluckett
in reply to: emluv

Hi,
at line 57 where it shows:
$sel = new MgSelection($map, $selText);

you need to replace it with:

$sel = new MgSelection($map);
$sel->Open($resourceSrvc, $mapName);

............


the Flexible Web Layout does not pass the XML so don't bother with the $CurrentSelection because it doesn't work (SEL)

By using the replacement above, you don't have to pass the $CurrentSelection anymore (NOTE: This will work for Basic Web Layouts too.) so you can use this modified InvokeReport.php for all your reports now.

regards
gordon


ps. This modified invokereport.php is available in the Autodesk MapGuide 2010 Autodesk Official Training Guide (see outline attached)
Message 7 of 7
emluv
in reply to: emluv

Gordon,
It worked!!! I have been struggling with this for so long. I do not know how to thank you!
Thanks:)
emluv

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report