Page 1 of 1

timport noid behavior

Posted: Tue Aug 18, 2009 10:19 am
by sgray1
When using timport in vortex with noid in the schema, a field with the name "id" is still required to have a type of "counter". Is there a way to remove this restriction?

timport noid behavior

Posted: Tue Aug 18, 2009 10:36 am
by mark
Not sure what you mean. Can you provide an example?
This works for me:

<timport "csv
noid
field id varchar 1
field f1 varchar 2
" "id,f1
abc,def
ghi,jkl">
{$id,$f1}
</timport>

and generates:

{abc,def}
{ghi,jkl}

timport noid behavior

Posted: Tue Aug 18, 2009 10:41 am
by sgray1
I'm sorry I didn't give you enough information. This occurs with XML input. The following script will get this error.

<!-- 015 /dev/scott/schematest:31: Field respecified with different attributes: "id" -->
<!-- 015 /dev/scott/schematest:31: Schema line 4: "field" failed -->

Notice in the schema I tried to make id a varchar. If you change the type to counter then the script works.

<script language=vortex>

<a name=main public>

<capture>
<results>
<result>
<id>4a8aa2571c</id>
<value>Test value 2009-08-18 08:45:11</value>
</result>
<result>
<id>4a8aa25723</id>
<value>Test value 2009-08-18 08:45:11</value>
</result>
<result>
<id>4a8aa2572a</id>
<value>Test value 2009-08-18 08:45:11</value>
</result>
</results>
</capture>
<$xml = $ret>

<capture>
trimspace
xml nohtml noid

field id varchar results/result/id ''
field value varchar results/result/value ''
</capture>
<$schema = $ret>
<timport $schema $xml></timport>
Count: $loop<br>
</a>

</script>

timport noid behavior

Posted: Tue Aug 18, 2009 10:47 am
by mark
"noid" is it's own command, not an attribute of xml. Use:

trimspace
xml nohtml
noid

timport noid behavior

Posted: Tue Aug 18, 2009 10:55 am
by sgray1
Got it. Somewhere along the line I started thinking options instead of commands. That makes perfect sense, thanks