I need to open CSV files with various settings.
One of the examples is below:
dt = Open(
filePath,
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 18 ),
Data Starts( 19 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
I would like to store these settings that come inside Import Settings() construct as a separate expression and then use it when opening a file.
Something like this (but it doesn't work this way obviously):
settings1 = Expr(
Import Settings(
<my import settings here>
)
);
settings2 = Expr(
Import Settings(
<some other import settings here>
)
);
if(condition, importSettings = settings1, importSettings = settings2)
dt = Open(
filePath,
Eval(importSettings)
);