timport noid behavior

Post Reply
sgray1
Posts: 5
Joined: Tue Aug 18, 2009 10:11 am

timport noid behavior

Post 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?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

timport noid behavior

Post 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}
sgray1
Posts: 5
Joined: Tue Aug 18, 2009 10:11 am

timport noid behavior

Post 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>
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

timport noid behavior

Post by mark »

"noid" is it's own command, not an attribute of xml. Use:

trimspace
xml nohtml
noid
sgray1
Posts: 5
Joined: Tue Aug 18, 2009 10:11 am

timport noid behavior

Post by sgray1 »

Got it. Somewhere along the line I started thinking options instead of commands. That makes perfect sense, thanks
Post Reply