Importing/exporting a CSV file
How can I import/export CSV file from/to Netlinx master??
Comments
-
You mean like using FTP? Filezilla is ideal but you can also use NetLinx Studio File Transfer.
If you mean in some programmed automated way, be more specific on what you are trying to do... -
A client called me for an assistance. He wants to change the label/name of the buttons (for lighting control) on a touch panel. But the names/labels are on the CSV files. See below module part. I am new on this and I need some guidance. Thanks in advance
MODULE_NAME='Module__Lutron_ZonenMgmt,Rev 1'(DEV vdv_Lutron_ZonenMgmt)
(***********************************************************)
(***********************************************************)
(* CONSTANT DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_CONSTANT//-----------------------------------------------------
// >> Lutron_ZonenMgmt KONSTANTEN <<
//-----------------------------------------------------
CHAR cLutron_ZonenMgmt__CSV_PATH[] = 'Lutron_ZonenMgmt'CHAR cLutron_ZonenMgmt__CSV_FILE[][50] = {
'Lutron_SzenenMgmt.csv',
'Lutron_LichtMgmt.csv',
'Lutron_StorenMgmt.csv',
'Lutron_VorhangMgmt.csv',
'Lutron_ZonenMgmt.csv',
'Lutron_WetterAlarmeMgmt.csv'
}(* Die Namen, welche in der EXCEL Liste in der Formatierung <XXXX hinterlegt sind, hier eintragen! )
CHAR cLutron_ZonenMgmt__ZONE_CMD_NAME[][20] = {
( Excel Scenen Management *)
'KNXSCENE',
'KNXSCENEORT',
'KNXSCENENAME',/* Excel Light Management */ 'KNXLIGHT', 'KNXLIGHTNAME', (* Excel Storen Management *) 'KNXSTOREN', 'KNXSTORENNAME', 'KNXVORHANG', 'KNXVORHANGNAME', (* Excel Zonen Management *) 'KNXMGMT', /* Excel Wetter/Alarme Management */ 'KNXWEATHER', 'KNXALARME' }//-----------------------------------------------------
// >> Lutron_ZonenMgmt KONSTANTEN <<
//-----------------------------------------------------(***********************************************************)
(* DATA TYPE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_TYPE//-----------------------------------------------------
// >> Lutron_ZonenMgmt STRUCTURE DATENBANK <<
//-----------------------------------------------------
//==> NEU: Structure DB ist im Handling definiert
// Befehle werden mittels Send_String abgesetzt
//-----------------------------------------------------
// >> Lutron_ZonenMgmt STRUCTURE DATENBANK <<
//-----------------------------------------------------(***********************************************************)
(* VARIABLE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_VARIABLE//-----------------------------------------------------
// >> Lutron_ZonenMgmt VARIABLEN <<
//-----------------------------------------------------
VOLATILE CHAR cLutron_ZonenMgmt__CSV_BUFFER[499999] //CSV Einlese bufferVOLATILE CHAR bLutron_ZonenMgmt__ActivateDiagnostic = TRUE //Diagnostik aktivieren
VOLATILE INTEGER nLutron_ZonenMgmt_ReadNextCSV
//-----------------------------------------------------
// >> Lutron_ZonenMgmt VARIABLEN <<
//-----------------------------------------------------(***********************************************************)
(* LATCHING DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_LATCHING(***********************************************************)
(* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_MUTUALLY_EXCLUSIVE(***********************************************************)
(* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *)
(***********************************************************)//__ Sende an Diagnostik __
DEFINE_CALL'Lutron_ZonenMgmt__Diagnostic'(CHAR cStringTxt[])
{
IF(bLutron_ZonenMgmt__ActivateDiagnostic) SEND_STRING 0,"'#[Lutron_ZonenMgmt] --> ',cStringTxt"
}//__ CSV File Lutron_ZonenMgmt auslesen (select) __
DEFINE_CALL'Lutron_ZonenMgmt__ReadCSV'(INTEGER nLutron_Group) //1=Szenen CSV, 2=Licht CSV, 3=Storen CSV, 4=Vorhang CSV, 5=ZonenMgmt CSV, 6=WetterAlarme CSV
{
STACK_VAR SLONG slFileOpenResult
STACK_VAR SLONG slFileReadResult
STACK_VAR SLONG slFileCloseResult
STACK_VAR SLONG slSetDirResultcLutron_ZonenMgmt__CSV_BUFFER = '' (* File öffnen *) slSetDirResult = FILE_SETDIR("'/',cLutron_ZonenMgmt__CSV_PATH") slFileOpenResult = FILE_OPEN("cLutron_ZonenMgmt__CSV_FILE[nLutron_Group]",1) //Only Read SELECT { (* File öffnen erfolgreich *) ACTIVE(slFileOpenResult >= 0): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Open file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - success'") (* File einlesen *) slFileReadResult = FILE_READ(slFileOpenResult, cLutron_ZonenMgmt__CSV_BUFFER, MAX_LENGTH_STRING(cLutron_ZonenMgmt__CSV_BUFFER)) CALL'Lutron_ZonenMgmt__Diagnostic'("'FILE_READ - Buffer lenght: ',ITOA(LENGTH_STRING(cLutron_ZonenMgmt__CSV_BUFFER))") SELECT { (* File einlesen erfolgreich *) ACTIVE(slFileReadResult >= 0): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Read file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - success'") (* File schliessen *) slFileCloseResult = FILE_CLOSE(slFileOpenResult) SELECT { (* File schliessen erfolgreich *) ACTIVE(slFileCloseResult = 0): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Close file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - success'") (* Schreibe Werte in die Datenbank *) CALL'Lutron_ZonenMgmt__WriteCSVinDatabase' } (* File schliessen fehlgeschlagen *) ACTIVE(1): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Close file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - failed! / ErrorCode: ',ITOA(slFileCloseResult)") } } } (* File einlesen fehlgeschlagen (Read Failed) *) ACTIVE(1): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Read file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - failed! / ErrorCode: ',ITOA(slFileReadResult)") } } } (* File öffnen fehlgeschlagen (Open Failed) *) ACTIVE(1): { CALL'Lutron_ZonenMgmt__Diagnostic'("'Set dir - failed! / ErrorCode: ',ITOA(slSetDirResult)") CALL'Lutron_ZonenMgmt__Diagnostic'("'Open file ',cLutron_ZonenMgmt__CSV_FILE[nLutron_Group],' - failed! / ErrorCode: ',ITOA(slFileOpenResult)") } } } -
For clarity, are you saying the only goal here is to alter the text on touch panel buttons that presently is based on the name of an internal variable corresponding to actual file names?
-
-
You can extract the file that needs to be edited through any FTP client - I use boring old Windows File Explorer more than anything else. Once the file is edited same applies for loading the file back to the master.
https://digitalcitizen.life/connect-ftp-server-windows-explorer
-
If you use Filezilla there’s protocol config that needs to be made on their FTP client, DOS modes or something, I’m not at my PC know so I can’t look and see.
-
@jan said:
YesIf you only want to alter button text, this isn't about import/export at all. It's about understanding dynamic touch panel design and management, sending text to display on buttons.
-
WinSCP is the best for all your file transfer needs. Just make sure to set the protocol to FTP when you connect to the netlinx master.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums

