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 Saimir.

    The Indusoft Time tag contains the time formatted as HH:MM:SS.
    It is likely that the Date tag also contains the / character.
    I expect the hst2txt() function is failing as Windows file names can not contain any of:
    \ / : * ? " < > |

    If you want the file to be named with date and time you will need to build a suitable string.
    I would recommend something like ...

    name = $Year&$Month&$Day&$Hour&$Minute&$Second&".csv"

    Regards,
    Greg Shearer
Reply
  • Hi Saimir.

    The Indusoft Time tag contains the time formatted as HH:MM:SS.
    It is likely that the Date tag also contains the / character.
    I expect the hst2txt() function is failing as Windows file names can not contain any of:
    \ / : * ? " < > |

    If you want the file to be named with date and time you will need to build a suitable string.
    I would recommend something like ...

    name = $Year&$Month&$Day&$Hour&$Minute&$Second&".csv"

    Regards,
    Greg Shearer
Children
No Data