Using the R metric created in Microstrategy does not return any result.

Feb 5, 2015 at 5:19 PM
Hi We have Microstrategy 9.3.1. I installed R-3.1.2 for lynux in our Intellignece server. I also installed the R integration Pack and We are able to launch R, load the library for Microstrategy R and do the deployR().

I upgraded my Microstrategy project after this installion as specified in the document.

I created a metric with the following definition.

RScript<[NumericParam1]="12", [NumericParam2]="12", [NumericParam3]="80", [NumericParam4]="95", [StringParam8]="", [StringParam9]="", [_RScriptFile]="/tmp/ARIMA.R", [_InputNames]="Target", SortBy= ([Field Sales Campaign]) >([Award Sales Amount]). When I execute the report with this metric, The report does not return any value for this metric.

I do not see any errors in DSSError log or I do not see the RscriptErrors.log file in my server.

can you help to see what I could be doing wrong?
Feb 6, 2015 at 3:41 PM
Hi Malathy,

Does Microstrategy give you a red text error when you try to run the report with the metric in it? I am not too familiar with Linux, but the RScriptErrors text file should appear in the RScripts folder in the R Integration Pack folder on the server.

My guess is that if the error isn't being captured and the report is returning no results, that something is amiss with the RScriptFile="/tmp/ARIMA.R" section of the code. In deployR() if you check the box in the top-right for 'Use RScripts Folder', that line converts to just the file name (e.g. _RScriptFile="ARIMA.R"). Copying and pasting the new Metric expression into a MicroStrategy metric might work, or at least it should save the error message to a place where you can locate it (the RScripts folder in R Integration Pack folder). Of course, you'll need to move the ARIMA.R file into the RScripts folder first.

Hope this helps!
Feb 6, 2015 at 6:14 PM
Hi, No I do not get any error on the Microstrategy side. Also I do not see RScriptErrors File anywhere on my Linux server. Regarding the /tmp/ARIMA.R. Originally we used the default location and it just said _RScriptFile="ARIMA.R". The ARIMA.R folder existin the Rsciprt folder. But since I was not getting any result I wanted to try and see if there was any permission issue and so copied it under /tmp folder and tried. But that did not create any difference.
Feb 6, 2015 at 7:14 PM
Edited Feb 6, 2015 at 7:15 PM
Hi Malathy,

That is a real puzzle! If you were getting an error in R, the ARIMA script should have caught it and pasted it into the RErrorsLog.

Looking at the R Integration Pack User Guide, I see that the default install path for Linux is /var/opt/R_Integration_Pack or $HOME/var/opt/R_Integration_Pack. The RScripts folder should be a sub-folder in there, and the RScriptErrors log file should post there when you run the ARIMA script. But as you said, the error log isn't anywhere on your server--so that's really strange.

Your Metric Expression looks good as far as I can tell. Is [Field Sales Campaign] a sequential numeric value? Are you using it as an Index or do you mean to use it as a Break-by? If you are using a Categorical variable as a Sort By, ARIMA may be getting confused and returning no model results.

One step that I know is key is to Save the ARIMA.R script in the deployR() utility whenever you make changes to it (e.g. variable name changes or changing parameters).

Lastly, the script needs additional rows in your Report order to return the 12 forecasted months. For example, if you want to use the past 24 months to predict the next 12, you'll need 36 rows in your Report.

I am sorry to say I haven't encountered your issue while developing with R, but I am running things on a Windows box.
Apr 22, 2015 at 12:23 AM
Apparently this happens when you use a derived metric. When I instead created the metric , the report returned results. Thanks.
Apr 22, 2015 at 12:57 PM
Hi Malathy,

That's interesting! I think MSTR v10 should rectify this, if it is due to using the derived metric. You should be able to use an Rscript in a derived metric, but you're right, sometimes there are discrepancies between using a derived metric and a 'real' metric.

Good luck with the rest of your R projects!