Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Output Order

Hi, I'm working with the SSE integration on a Qlik server.

What I'm tring to achive is to have for my dimension ( MonthYear ) a forecast.

Seems everithing fine but there is one big mistake that I get, in the forecast output I have the data associated to the wrong dimension.

Sense_output.png

In green you can see the inpunt from Qlik. In Blue the output that I get. consider that in the R enviroment the Blue column comes in data.frame format.

If you have any suggestion to solve this issue it would be appreciated.

Labels (1)
1 Solution

Accepted Solutions
mohan_1105
Partner - Creator III
Partner - Creator III

Hi Paolo,

Here we cannot write R script like what we usually write in R. We have to tell Qlik sense very specifically which variable from the data frame we need.

For example,

R.ScriptEval(

'

library(forecast);

forecast

     (

          auto.arima

          (

               ts

               (

                    a, frequency = c(2016,12)

               ), h= 6

          )

     )

', sum(Pass) as a)

If you run this script in R, it will return a data frame. Qlik doesn't know how to plot the data frame either R. So you have to be specific in mentioning the variables.

Now, I rewrite the above script into by adding the data frame column,

R.ScriptEval(

'

library(forecast);

forecast

     (

          auto.arima

          (

               ts

               (

                    a, frequency = c(2016,12)

               ), h= 6

          )

     ) [,3]

', sum(Pass) as a)

which returns the point forecast value.

I suggest you, go through the example app released along with the SSE. In case, if you're not clear about it. Please explain us your code and also share the log file.

Hope it is useful.

Regards,

Mohan

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Hi Paolo,

Can you provide the R-script(s) that you use?

Regards,

Bas

Anonymous
Not applicable
Author

Hi, here the example of the R script:

R.ScriptEvalEx('

library(forecast);

a=q$pass;

serie_all<-ts(na.omit(a),frequency = 12);

w1<-ts(serie_all[1:50],frequency=12);

w2<-ts(serie_all[51:56],frequency=12);

AA<-auto.arima(w1);

AA_forecast<-forecast(AA,h=5);

a<-as.yearmon(time(serie_all));

out<-c(AA_forecast$x,AA_forecast$mean;

out;

',

passengers as pass)

Basically I would like to plot on the original data a forecast.

What I get as output is a different order of the observations I gave as input. I've tryed to debug it saving the vector of R at the beginngin ad at the end, and in R is ok.

Is there a way to create an index in order to give the data back in the same order?

Thanks

Anonymous
Not applicable
Author

Hi Paolo,

Currently, there is no way to control the order that data is sent to R. So Qlik is expecting the same ordering of return data as the order is sent to R.

Have a look at this project: Advanced Analytics Expression Builder

It may help you create the right R-script to suit your needs.

Regards,

Bas.

mohan_1105
Partner - Creator III
Partner - Creator III

Hi Paolo,

Here we cannot write R script like what we usually write in R. We have to tell Qlik sense very specifically which variable from the data frame we need.

For example,

R.ScriptEval(

'

library(forecast);

forecast

     (

          auto.arima

          (

               ts

               (

                    a, frequency = c(2016,12)

               ), h= 6

          )

     )

', sum(Pass) as a)

If you run this script in R, it will return a data frame. Qlik doesn't know how to plot the data frame either R. So you have to be specific in mentioning the variables.

Now, I rewrite the above script into by adding the data frame column,

R.ScriptEval(

'

library(forecast);

forecast

     (

          auto.arima

          (

               ts

               (

                    a, frequency = c(2016,12)

               ), h= 6

          )

     ) [,3]

', sum(Pass) as a)

which returns the point forecast value.

I suggest you, go through the example app released along with the SSE. In case, if you're not clear about it. Please explain us your code and also share the log file.

Hope it is useful.

Regards,

Mohan

Anonymous
Not applicable
Author

Ok thansks