Does anyone know if there is a way or have an example of running a report design that then updates a file stored in Google Drive?
Can you help answer this question?
We've noticed this question is over 30 days old and hasn't received a response. We're turning to you, the community, to help answer it.
This generic response is intended to prompt discussion in this post. The question remains open to your answers, suggestions, and best practices.
If you posted this question and were able to resolve the issue, please share your solution here with others. If you still need additional help, though, please let us know. Your question and its resolution are important to us, and we want to help.
What file is being updated? Just a file on the local system where the report is executing? Or are you trying to get the output of the report to publish to google drive?
There's no built in functionality for working with google drive, all of it would need to be implemented via custom code either while the report is executing, or via code that runs in the browser.
This custom code would need to utilize Google Drive API for programmatically uploading files to Drive, which I'm unfamiliar with.
For pushing the report output to google drive, you'd need to do something similar to above, but also would need to obtain the report output, which I believe would be a bit more difficult.
You mentioned scheduling it, so I assume you're on an iHub? I work on designs, so I was thinking of design solutions. Thinking more about it now, your best bet may be to externalize your code.
What I mean by that, is to probably make a custom application the downloads the outputs from finished jobs (using IDAPI), and uploads it to google drive. This would be outside the report design, and I feel would be the easiest to maintain.
Regarding the IDAPI aspect, you'd essentially just query for completed jobs on an interval, then when one is completed, you'd do a download operation of that file.
From there you'd be using the Google APIs to upload a file to the Drive. That, I don't really know about, but you could base it off a sample online somewhere for whichever language you'd be using.
It's feasible you could get this same functionality via script inside an rptdesign, but it would a bit more of a hassle to maintain.
The below sample is how you might download a pdf from the iHub to a local location.
actuateAPI = new ActuateAPILocatorEx();
proxy = (ActuateSoapBindingStub) actuateAPI.getActuateSoapPort(new java.net.URL("http://samplehost:8000"));
com.actuate.schemas.Login request = new com.actuate.schemas.Login();
com.actuate.schemas.LoginResponse response = proxy.login(request);
String authID = response.getAuthId();
com.actuate.schemas.DownloadFile df = new com.actuate.schemas.DownloadFile();
com.actuate.schemas.SelectFiles sf = new com.actuate.schemas.SelectFiles();
com.actuate.schemas.SelectFilesResponse sfr = null;
com.actuate.schemas.DownloadFileResponse dfr = null;
com.actuate.schemas.Attachment att = null;
com.actuate.schemas.File fileArray = null;
byte content = null; //Sample
String downloadFilePath = "C:/Users/jneneman/NullReportPDF.pdf";
dfr = proxy.downloadFile(df);
att = dfr.getContent();
content = att.getContentData();
FileOutputStream fos = new FileOutputStream(downloadFilePath);
From there you can either setup a local location as your drive location: https://www.howtogeek.com/228989/how-to-use-the-desktop-google-drive-app/
Alternatively you could use the Google Drive REST API v3, I was skimming through a few things and the samples look like they are spot on from:
Setting up the connection:
Uploading a File, like an image: