|
|
Advanced options
The
command line interface supports dynamic SQL commands each time the
export process is ran. However, this requires some manual editing
of the export settings file.
We will use the following export settings file that was created
using the Export Items wizard for
this example.
|
[Export]
ExportImages=1
ExportBinaryData=0
TargetPath=g:\export\images\
NamingConvention=<description>
SQLQuery=SELECT ID, description, binarydata FROM imagesets ORDER BY ID
BatchSize=10
NamingConventionBin=
TargetPathBin=
OverwriteExistingBin=0
MakeUniqueNamesBin=1
ExportPdf=0
ExportDoc=0
ExportXls=0
ExportPpt=0
ExportRar=0
Export7z=0
ExportGz=0
ExportBz2=0
ExportZip=0
ExportMp3=0
ExportWav=0
ExportHTML=0
ExportXML=0
ExportUnknown=0
ExportFormat=0
PDFCompression=0
OriginalFormat=1
PngCompression=0
PngFilterType=0
MakeUniqueNamesImage=1
JpegQuality=0
[Database]
Connect=0=(local):sivsample::0
|
|
The
parameter we will need to edit is the SQLQuery
parameter,
highlighted in red above.
Option 1:
|
Instead
of explicitly providing the SQL command to run, you can provide the
name of a file that contains the SQL command to use. You can use
this option when you have other applications that can dynamically
generate the SQL command to use.
|
|
To
specify the file to use, use the <file>
tag
e.g.
|
|
[Export]
...
SQLQuery=<file=g:\export\sql.txt>
...
|
|
|
In the
above example, the command line interface will use the contents of
the file sql.txt
as the
SQL command to run.
|
Option
2:
|
You
can also provide a list of values from a file to append into the
SQL command that is already provided. E.g.
|
|
[Export]
...
SQLQuery=SELECT ID, description, binarydata FROM imagesets WHERE ID IN (<integerlist=g:\exports\IDList.txt>) ORDER BY ID
...
|
|
|
In the
above example, the command line interface will read the contents of
the file IDList.txt,
and append the values to form the complete SQL command. The file
just needs to contain one value per line e.g.
|
|
The
SQL command that is then used would be this:
|
|
SELECT ID, description, binarydata FROM imagesets WHERE ID IN (34, 56, 75, 89) ORDER BY ID
|
|
|
To use
a list of text values, use the <stringlist>
tag
e.g.
|
|
[Export]
...
SQLQuery=SELECT ID, description, binarydata FROM imagesets WHERE description IN (<stringlist=g:\exports\DescriptionList.txt>) ORDER BY ID
...
|
|
|
Note
that each text value in the file need not be enclosed in single
quotes.
|
Option
3:
|
In
situations where you need to export only new binary data each time,
the command line interface can maintain a file that contains the
last processed value for you. That file can then be used as input
to the SQL command.
|
|
E.g.
you have a table that contains binary data, where the ID value is a
primary key, only new binary data are added, and existing binary
data are never modified. You could then use the following base
query:
|
|
[Export]
...
SQLQuery=SELECT ID, description, binarydata FROM imagesets WHERE ID > (<integerlist=g:\exports\LastID.txt>) ORDER BY ID
...
|
|
|
Note
that we need to sort by the ID
column,
so that the last processed row contains the latest ID
value.
|
|
To get
the command line interface to maintain the LastID.txt
file
for us, we need to add a StoredValue
section
into our export settings file e.g.
|
|
[Export]
...
[Database]
...
[StoredValue1]
filename=g:\exports\LastID.txt
column=ID
|
|
|
This
tells the command line interface to store the last ID
value
into the g:\exports\LastID.txt
file
when the export process has completed.
|
|
You
can have multiple StoredValue
sections,
but they need to be numbered sequentially e.g. StoredValue1,
StoredValue2,
StoredValue3
etc.
|
|