Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
bw
Occasional Contributor
Posts: 11
Registered: ‎05-06-2016

GMSC - Saving file at clients PC.

Hi,

 

I'm wondering is it possible to save file at Geomedia Smart Client user's PC using .Net trigger extentions?

 

Let's say i have following code:

using Intergraph.Emea.Data;
using Intergraph.Emea.Diagnostics.Log;
using Intergraph.Emea.Ioc;
using Intergraph.Emea.Placeholders;
using Intergraph.Emea.Workflows;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Intergraph.Emea.Workflows.Triggers
{
    [ExtensibleType("CustomTrigger")]
    public class CustomTrigger : WorkflowTriggerBase
    {
...
...
...
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), fileDirectory);

    if (!Directory.Exists(path ))
            {
                Directory.CreateDirectory(path );
            }
           

            using (FileStream fs = new FileStream(Path.Combine(path , TargetReportName + "." + fileFormat), FileMode.Create))
            {
                fs.Write(file.Data, 0, file.Data.Length);
            }

}

 

this file will be saved at serwer's machine. Is there way to save this file at direct user machine?

 

Thanks in advance,

Bartek.

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: GMSC - Saving file at clients PC.

I would say it is not possible to do it this way. 

 

1) custom trigger just call the server part of GMSC and server has no access to the client side (you can access the server file system, but not the client's one).

2) If you need to save something to the client file system, you have to use Java plugin - you can manage what you want to save and where or use built-in Javascript (try to check action IG.downloadFormFile) - http://community.hexagongeospatial.com/t5/Developers-Knowledge-Base/Handle-Files-in-GMSC-How-To/ta-p...

 

I can imagine, you prepare the file(s) you need with the custom trigger and then in the .done() event of the first trigger you can download it with IG.downloadFormFile and after download, you can delete it from the server environment with the custom trigger if it is necessary. 

Super Contributor
Posts: 301
Registered: ‎02-09-2016

Re: GMSC - Saving file at clients PC.

Hi ,

 

Have you looked at the GMSC automate export service? Using Java Plugin is the easy way to do. With java plugin, you can do a lot of jobs such as constantly watch a folder, modify the downloaded file or launch it.

 

Kind regards,

 

bw
Occasional Contributor
Posts: 11
Registered: ‎05-06-2016

Re: GMSC - Saving file at clients PC.

Hi,

 

Thank you for your responses - i will look into this and if i find out anthing usefull i will post it as solution.

 

 

bw
Occasional Contributor
Posts: 11
Registered: ‎05-06-2016

Re: GMSC - Saving file at clients PC.

Ok, so i managed to acheieve goal thanks to this mentioned link:

 http://community.hexagongeospatial.com/t5/Developers-Knowledge-Base/Handle-Files-in-GMSC-How-To/ta-p...

but the problem is that i'm using javascript function called IG.downloadFormFile which is, unfortunately, absolutly undocumented - i cant find a word about it in javascript docs. Does anyone have anything about this function? What i really need is to specyfy path where the document should be saved by default. 

 

Thanks in advance.

Super Contributor
Posts: 301
Registered: ‎02-09-2016

Re: GMSC - Saving file at clients PC.

Hi bw, 

 

I think that problem is the reason that we switch to develop a Java plugin. We faced a scenario that a user want to download a file and the file should automatically launch itself if it is a pdf file. In the Java plugin we implement a Javascript object interface to talk to the java fx workflow browser, when a user clicks on the button, it will send the url to the plugin, calling the download function in the plugin. So, the file is downloaded to an designated location.

 

Kind regards,

Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: GMSC - Saving file at clients PC.

[ Edited ]

Hi,

 

if you want to directly open the file on the client side, you can use IG.downloadAndOpen(URL). The IG.downloadFormFile is defined this way:

 

IG.downloadFormFile = function (parameter) {
    var url = IG.createFieldDownloadUrl(parameter);
    if (parameter.openFile) {
        return IG.downloadAndOpen(url);
    }
    else {
        return IG.downloadAndSave(url);
    }
}

I am not sure you can specify a default path to save the file on the client side, should be dependent on the browser.

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.