0

I am currently developing a database integrated forecasting tool for a costumer. I am using mainly R and TM1 Persepctives. To connect R with tm1 I use tm1r. For Data import from tm1 to r it works fine.

However, when I am trying to write back the calculated forecast from R to tm1, I run into problems.

I will give you some reprex data, so you can have a look at the output. If I use "tm2_send_data" instead of "tm1_send_dataset" it works fine too.

The latter function gives me the Error : "Error in if (is.character(txt) && length(txt) == 1 && nchar(txt, type = "bytes") < : missing value where TRUE/FALSE needed"

I have no clue, what this is supposed to mean! I tried some formatting of the data types, without any effect.

library(tm1r)

# data
values <- data.frame(fake_values = 
  c(105,147,159,232,312,337,285,188,257,10,98,27)
  )
date_stamps <- c("2021001","2021002","2021003","2021004","2021005","2021006","2021007","2021008","2021009","2021010","2021011","2021012")
rownames(values) = date_stamps

# Send dataset to TM1
con_obj <- tm1_connection("localhost", "8840", "test_admin", "")

tm1_send_dataset(
  con_obj,
  valueset = values, cube = "pvl_FORECAST_HILFSWÜRFEL",
  rowdim = "PVL_test_Zeit", coldim = "pvl_Produkt",
  titledim1 = "DATENART", titleel1 = "FC",
  titledim2 = "Version", titleel2 = 'Version_Bearbeitung',
  titledim3 = "FC-Scheibe", titleel3 = "ML_FC_2021",
  titledim4 = "PVL_test_Kunde", titleel4 = "MGR_domestic_D",
  titledim5 = "PVL_test_Measure", titleel5 = "Menge_EA"
)
Leonhard Geisler
  • 506
  • 3
  • 15
  • the error is thrown when you have a NA in your condition. I would probably help to use `debug` on your function to see what caused the error – Cath Nov 08 '21 at 15:44
  • any suggestions how to use effective debugging on this would help. Traceback and Debugging mode do not give me relevant insights so far – Leonhard Geisler Nov 08 '21 at 16:12
  • `debug` on your "parent" function should give you hint on which specific part throws the error. "txt" is NA at one point and you need to know what causes that (sorry I cannot help more on the specific function, I have never used this package) – Cath Nov 08 '21 at 16:15
  • I did just rewrite the whole function row by row. Also I created another data cube in tm1 with the name "FC_OUTPUT". The cube name was the only change overall. That just did the trick. Maybe tm1 rest doesn't like mutated vowels I guess – Leonhard Geisler Nov 08 '21 at 16:41

0 Answers0