1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
<!doctype html public "-//W30//DTD W3 HTML 2.0//EN">
<HTML>
<!-- This file was generated using SDF 2.001 by
Ian Clatworthy (ianc@mincom.com). SDF is freely
available from http://www.mincom.com/mtr/sdf. -->
<HEAD>
<TITLE>Interchange Tags Reference: import</TITLE>
</HEAD>
<BODY BGCOLOR="ffffff" LINK="993333">
<DIV CLASS="header">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="ictags_35.html">Parent Topic</A> | <A HREF="ictags_72.html">Previous Topic</A> | <A HREF="ictags_74.html">Next Topic</A> <BR><A HREF="../index.html" TARGET="_top">Catalog</A></P>
</DIV>
</DIV>
<DIV CLASS="main">
<H2>4.38. import</H2>
<H3><A NAME="Summary">4.38.1. Summary</A></H3>
<P>Parameters: <B>table type</B></P>
<P>Positional parameters in same order.</P>
<P><B>The attribute hash reference is passed</B> after the parameters but before the container text argument. <B>This may mean that there are parameters not shown here.</B></P>
<P>Interpolates <B>container text</B> by default>.</P>
<P>This is a container tag, i.e. [import] FOO [/import]. Nesting: NO</P>
<P>Invalidates cache: <B>YES</B></P>
<P>Called Routine:</P>
<P><B>ASP-like Perl call:</B></P>
<PRE>
$Tag->import(
{
table => VALUE,
type => VALUE,
},
BODY
)
OR
$Tag->import($table, $type, $ATTRHASH, $BODY);
</PRE>
<P>Attribute aliases</P>
<PRE>
base ==> table
database ==> table
[<B>import</B> table type<I>other_named_attributes</I>]
</PRE>
<TABLE CLASS="columns" BORDER>
<TR CLASS="heading">
<TD VALIGN='Top'>
<STRONG>Parameters</STRONG>
</TD>
<TD VALIGN='Top'>
<STRONG>Description</STRONG>
</TD>
<TD VALIGN='Top'>
<STRONG>Default</STRONG>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#import_table">base</A>
</TD>
<TD VALIGN='Top'>
Alias for table
</TD>
<TD VALIGN='Top'>
DEFAULT_VALUE
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#import_table">database</A>
</TD>
<TD VALIGN='Top'>
Alias for table
</TD>
<TD VALIGN='Top'>
DEFAULT_VALUE
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#import_table">table</A>
</TD>
<TD VALIGN='Top'>
</TD>
<TD VALIGN='Top'>
DEFAULT_VALUE
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#import_type">type</A>
</TD>
<TD VALIGN='Top'>
</TD>
<TD VALIGN='Top'>
DEFAULT_VALUE
</TD>
</TR>
</TABLE>
<TABLE CLASS="columns" BORDER>
<TR CLASS="heading">
<TD VALIGN='Top'>
<STRONG>Attributes</STRONG>
</TD>
<TD VALIGN='Top'>
<STRONG>Default</STRONG>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#import_ATT1">ATT1</A>
</TD>
<TD VALIGN='Top'>
<I>none</I>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#attr_interpolate">interpolate</A>
</TD>
<TD VALIGN='Top'>
<I>No</I>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
<A HREF="#attr_reparse">reparse</A>
</TD>
<TD VALIGN='Top'>
<I>Yes</I>
</TD>
</TR>
</TABLE>
<TABLE CLASS="columns" BORDER>
<TR CLASS="heading">
<TD VALIGN='Top'>
<STRONG>Other_Charactreristics</STRONG>
</TD>
<TD VALIGN='Top'>
<STRONG> </STRONG>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
Invalidates cache
</TD>
<TD VALIGN='Top'>
<I>YES</I>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
Container tag
</TD>
<TD VALIGN='Top'>
<I>Yes</I>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
Has Subtags
</TD>
<TD VALIGN='Top'>
<I>No</I>
</TD>
</TR>
<TR>
<TD VALIGN='Top'>
Nests
</TD>
<TD VALIGN='Top'>
<I>No</I>
</TD>
</TR>
</TABLE>
<P><B>Tag expansion example:</B></P>
<PRE>
[import table type]
---
TAGRESULT
</PRE>
<P><B>ASP-like Perl call:</B></P>
<PRE>
$Tag->import( { table => VALUE_table
type => VALUE_type
}, $body );
</PRE>
<P>or similarly with positional parameters,</P>
<PRE>
$Tag->import(table,type, $attribute_hash_reference, $body);
</PRE>
<H3><A NAME="Description">4.38.2. Description</A></H3>
<P>Named attributes:</P>
<PRE>
[import table=table_name
type=(TAB|PIPE|CSV|%%|LINE)
continue=(NOTES|UNIX|DITTO)
separator=c]
</PRE>
<P>Import one or more records into a database. The <TT>type</TT> is any of the valid Interchange delimiter types, with the default being defined by the setting of the database <I>DELIMITER</I>. The table must already be a defined Interchange database table; it cannot be created on the fly. (If you need that, it is time to use SQL.)</P>
<P>The <TT>type</TT> of <TT>LINE</TT> and <TT>continue</TT> setting of <TT>NOTES</TT> is particularly useful, for it allows you to name your fields and not have to remember the order in which they appear in the database. The following two imports are identical in effect:</P>
<PRE>
[import table=orders]
code: [value mv_order_number]
shipping_mode: [shipping-description]
status: pending
[/import]
[import table=orders]
shipping_mode: [shipping-description]
status: pending
code: [value mv_order_number]
[/import]
</PRE>
<P>The <TT>code</TT> or key must always be present, and is always named <TT>code</TT>.</P>
<P>If you do not use <TT>NOTES</TT> mode, you must import the fields in the same order as they appear in the ASCII source file.</P>
<P>The <TT>[import ....] TEXT [/import]</TT> region may contain multiple records. If using <TT>NOTES</TT> mode, you must use a separator, which by default is a form-feed character (^L).</P>
<H4><A NAME="{{CMD[id="import_table"]table}}"> </A>4.38.2.1. <A NAME="import_table">table</A></H4>
<H4><A NAME="{{CMD[id="import_type"]type}}"> </A>4.38.2.2. <A NAME="import_type">type</A></H4>
</DIV>
<DIV CLASS="footer">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="ictags_35.html">Parent Topic</A> | <A HREF="ictags_72.html">Previous Topic</A> | <A HREF="ictags_74.html">Next Topic</A> <BR><A HREF="../index.html" TARGET="_top">Catalog</A></P>
</DIV>
</DIV>
</BODY>
</HTML>
|