SD card

I want to use an SD card to expand the Flexy memory because my client wants to keep the data for a long time, but I want to know:
1- When the Flexy memory is full, the Flexy automatically saves the data on the SD card? or do I need a script for that?

2- I want to create a trend chart to display: temperature, pressure, level … Can I display all data (Flexy memory and SD card) in the trend?

The Flexy doesn’t do it automatically. You’ll need a script. There’s a good example in this topic: https://forum.hms-networks.com/t/basic-ide-code-to-send-data-file-to-email/889

Data on the SD card is not available for trends in the Flexy. Only data in the active historical log will display in the built in trends in the Flexy’s interface or in trends that you build using viewON.

Hi,
Are you sure that is the good link? this link is about sending data file to email, but for me I want to save data (Historical log file) in SD card when the Flexy memory is full.

Sorry, you’re right. I included the wrong link there. You’ll want something like this:

CLS
REM GENERATE REPORT EVERY HOUR
ONDATE 1,“0 * * * *”,“GOTO GENERATE_REPORT”
ONSTATUS “GOTO SCHEDULEDACTION_END”
GOTO GENERATE_REPORT
END

GENERATE_REPORT:
//Check if SD card is inserted or if there is enough space
SETSYS INF,“LOAD”
SDCardSize$ = GETSYS INF, “SDExtFree”
SDCardSize_Int% = Val SDCardSize$
IF SDCardSize_Int% > 5000 THEN // 5 MB remains
GOSUB READ_LASTTMS
LAST_TIME$ = @GetCurrentTimeStamp$()
EBD_STRING$ = “$dtHL$ftT$et” + LAST_TIME$ + “$st” + LASTTMS$
FILENAME$ = “/usr/sdext/DataReport” + LAST_TIME$ + “.txt”
WRITEEBD EBD_STRING$, FILENAME$
ActionID% = GETSYS Prg, “ACTIONID”
ELSE
LOGEVENT “EUM Card full or not present”, -1
ENDIF
END

SCHEDULEDACTION_END:
CurID% = GETSYS Prg,“EVTINFO” : REM Get ActionID
REM : Check if it is the right schedule action to save last timestamp otherwize do nothing
If ActionID% = CurID% THEN
SETSYS Prg, “ACTIONID”, CurID%
CurID_Status% = GETSYS Prg,“ACTIONSTAT”
REM Action successfully done --> Write last timestamp in file
IF CurID_Status% = 0 THEN
LOGEVENT “FILE " + FILENAME$ + " SUCCESSFULLY EXPORTED”, 100
@WRITETMS(LAST_TIME$)
ELSE
LOGEVENT “FILE " + FILENAME$ + " NOT SUCCESSFULLY EXPORTED”, 0
ENDIF
ENDIF
END

READ_LASTTMS:
SETSYS PRG,“RESUMENEXT”,1
REM GET LAST TIMESTAMP
OPEN “file:/usr/tms.dat” FOR BINARY INPUT AS 1
LASTTMS$ = GET 1,15
CLOSE 1

Cur_Err% = GETSYS PRG,“LSTERR”

IF Cur_Err% = 33 THEN //REM File does not exist
LASTTMS$= “01011970_000000”
SETSYS PRG,“LSTERR”,0
ENDIF

SETSYS PRG,“RESUMENEXT”,0
CLS

RETURN

FUNCTION WriteTMS($LastTimeStamp$):
OPEN “file:/usr/tms.dat” FOR BINARY OUTPUT AS 1
PUT 1,$LastTimeStamp$
CLOSE 1
ENDFN

FUNCTION GetCurrentTimeStamp$()
REM TIME$ = 19/12/2014 10:03:01
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + “_” + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16)+ $EWON_TIME$(18 To 19)
ENDFN

Topic closed due to inactivity.