Hst2txt

Hi I need to extract evry day the trend history in a csv file with a different name so i wrote this function:

Dim name
name = $Date&$Time&".csv"
$hst2txt($date, "00:00:00", 24, 1, name)

the problem is that this function does not work. But if i give name = "blablabla.csv" it works.

Oviously i use a scheduler function to call this script every day.

Sorry for my english. Saimir
Parents
  • Hi again Saimir.

    To ensure the file name format remains consistent regardless of day and month, you will also need to format the Month and Day strings to be two characters.
    To do this you can use the Format function:

    name = $Format("%04d",$Year)&$Format("%02d",$Month)&$Format("%02d",$Day)&".csv"
    or
    name = CStr($Year)&$Format("%02d",$Month)&$Format("%02d",$Day)&".csv"

    should work.
Reply
  • Hi again Saimir.

    To ensure the file name format remains consistent regardless of day and month, you will also need to format the Month and Day strings to be two characters.
    To do this you can use the Format function:

    name = $Format("%04d",$Year)&$Format("%02d",$Month)&$Format("%02d",$Day)&".csv"
    or
    name = CStr($Year)&$Format("%02d",$Month)&$Format("%02d",$Day)&".csv"

    should work.
Children
No Data