-1

I read a number for example 42000 that I need to convert into date in the format DD/MM/YY in a macro, not a Load statement.

In the macro the number is stored in vInput and the new value will be stored in vDate. Neither vDatet = Date(vInput, 'DD/MM/YYYY') or vDate = date(vInput#(Date,'DD/MM/YYYY')) works. Any ideas?

1 Answers1

2

You can use the script below to get the content of vInput variable, evaluate the Qlik expression and save the result in the vDate variable.

Using the script below if vInput is equal to 42000 the vDate will be equal to 27/12/2014

sub ChangeDate

  set vInputVar = ActiveDocument.Variables("vInput")
  vInput = vInputVar.GetContent.String

  changedDate = ActiveDocument.Evaluate("=Date(" & vInput & ",'DD/MM/YYYY')")

  set vDateVar = ActiveDocument.Variables("vDate")
  vDateVar.SetContent changedDate , true

end sub
Stefan Stoichev
  • 4,615
  • 3
  • 31
  • 51