DIAdem Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Webasto-Maier

Bug in the RTT and TTR function

Status: Completed

Now works fine in DIAdem 2019 SP1.

 

dim zeit
zeit = "1.5.2015"
msgbox rtt(TTR(Zeit,"#DD.MM.YYYY"))

 

Thank you and greetings

Walter

There is obviously a problem converting time Strings like 1.5.2015 correctly to time data and back. Everything works well as long as Day and Month have really both two digits. As long as this is not fullfilled, the conversion is wrong when the TTR is then used like this:

 

D2AXISXBEGIN=TTR(ZeitMin_,"#DD.MM.YYYY")

 

Then 2000 years missing and the date arriving the report is 1.5.0015 what is in fact slightly different. I off course programmed a workaround filling up the "0" in front of a one digit day and month, but that shout be done by the TTR correctly.

2 Comments
Walter_Rick
NI Employee (retired)
Status changed to: Under Consideration

Hello

Thank you for your request. R&D has read this suggestion and it will be included in feature planning discussions for future DIAdem versions. In the meantime you can use the function below.

Greetings

Walter

 

xyz = TTR(FillDateStrWithZero(ZeitMin_), "#DD.MM.YYYY")

function FillDateStrWithZero(sDate)
  dim sSeparator, dTArray
 
  if inStr(sDate, ".") > 0 then
    sSeparator = "."
  elseif inStr(sDate, "-") > 0 then
    sSeparator = "-"
  elseif inStr(sDate, "_") > 0 then
    sSeparator = "_"
  else
    sSeparator = ""
  end if
 
  if sSeparator = "" then exit function
  dTArray = split(sDate, sSeparator)
 
  if len(dTArray(0)) = 1 then dTArray(0) = "0" & dTArray(0)
  if len(dTArray(1)) = 1 then dTArray(1) = "0" & dTArray(1)
  if len(dTArray(2)) = 2 then dTArray(1) = "20" & dTArray(1)
 
  FillDateStrWithZero = dTArray(0) & "." & dTArray(1) & "." & dTArray(2)
 
end function

Walter_Rick
NI Employee (retired)
Status changed to: Completed

Now works fine in DIAdem 2019 SP1.

 

dim zeit
zeit = "1.5.2015"
msgbox rtt(TTR(Zeit,"#DD.MM.YYYY"))

 

Thank you and greetings

Walter