[V4MD] Empty field returns <void>, can it return ""?
Irv Kalb
Irv at furrypants.com
Tue Sep 23 13:44:21 CDT 2008
Thanks Bart, but I don't understand how to do either of your suggestions.
To create a table, I parse through a list of fields and use the
following to create each string field:
oField = oTable.createStringField(sFieldName, iLength, lFlags)
the value of lFlags is either the empty list [] or if this field is
intended to be indexed, then it will have the value of [#fIndexed].
I see that there is this additional flag type called #fNullable, but
it looks like I want the opposite of #fNullable, which I would assume
would be the default - the empty string.
How do I set a default value using createStringField and/or ImportText?
The documentation for ImportText contains this comment:
f the cursor represents a subset of the table-fields, then the
omitted fields will be filled with
NULL values if the field in NULLABLE or blank values otherwise.
I assume that this is supposed to say:
f the cursor represents a subset of the table-fields, then the
omitted fields will be filled with
NULL values if the field is NULLABLE or blank values otherwise.
But that's not what I am seeing. I am seeing empty text fields set to VOID.
Confused ...
Irv
At 7:27 PM +0200 9/23/08, Bart Pietercil wrote:
>Hi Irv,
>
>just a suggestion, what happens when you set this fields to have a
>default value and specify nothing in the value ?
>
>of course you could always do update t1 set f1 = "" where f1 is null
>
>hth
>
>Bart
>
>On 23 Sep 2008, at 19:18, Irv Kalb wrote:
>
>> Hi,
>>
>> I've got a new one today. I hope I'm not using up my quota of help
>> here :) (I really do appreciate the quick responses here.)
>>
>> My customer creates their tables in Excel and exports them to tab
>> delimited files. In some of their records, they have no entry for
>> one or more fields. For example, they may have a record with fields
>> (all are 'string' fields):
>>
>> A B C D E
>>
>> And a record may look like:
>>
>> ValueOfA<tab>ValueOfB<tab>ValueOfC<tab><tab>ValueOfE
>>
>> In this record, there is no value for D. When I try to get this
>> record in my application, I get a list back like this:
>>
>> ["ValueOfA", "ValueOfB", "ValueOfC", <Void>, "ValueOfE"]
>>
>> Which seems perfectly reasonable. However, I am converting code
>> from V12 to Valentina, and in the same situation, V12 returned a list
>> like this:
>>
>> ["ValueOfA", "ValueOfB", "ValueOfC", "", "ValueOfE"]
>>
>> So the value I got for D from V12 was an empty string and there is
>> code throughout my application that checks for this empty string.
>> There are many many places where such empty fields are allowed, and
>> in all cases, my code checks for the empty string to know that there
>> was no value entered.
>>
>> Question: Is there any quick way to either build the database so
>> that empty fields are translated the empty string (""), or when
>> retrieving data from the database, that <void> values could be
>> converted to the empty string("")? If not, I'll either write my
>> own, or change a bunch of code.
>>
>> My utility to create the database uses the following key line for
>> building each table:
>>
>> curs.ImportText(sFileName, TAB, RETURN, "UTF-8", TRUE) -- I also
>> tried "" for the encoding with no difference
>>
>> The documentation talks about a #fNullable flag type for fields, but
>> it looks like is an option and not the default. That is, I would
>> only expect them to be set to VOID if the #fNullable attribute was
>> turned on. From what I read, I would expect all string fields to
>> default to an empty string, but this is not what I am seeing.
>>
>>
>> Thanks,
>>
>> Irv
>>
>> --
>>
>> Multimedia R Us
>> _______________________________________________
>> Valentina mailing list
>> Valentina at lists.macserve.net
>> http://lists.macserve.net/mailman/listinfo/valentina
>
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina
--
Multimedia R Us
More information about the Valentina
mailing list