# How do I read "False" into a boolean type field?

**URL:** <https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734>\
**Category:** CloverDX Platform\
**Created:** [August 11, 2010, 12:00am UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734 "2010-08-11T00:00:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![crrb](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@crrb](https://forum.cloverdx.com/u/crrb)\
**Post date:** [August 11, 2010, 12:00am UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/1 "2010-08-11T00:00:00Z")

</div>

I am new to Clover (using 2.9.4), and so …

I have a UniversalDataReader taking in a CSV file in UTF-16 with | for delimiters.  
The output ports are mapped to a DB derived metadata record with string, long, integer, boolean, and date fields.  
I was having difficulty getting the parse to work, so rolled it all back to all string type fields and am moving forward with  
each data type, one at a time. The boolean surprised me - only because the error message would indicate that my  
specific case was omitted from the wide selection of options:

…(boolean) cannot be set to “False” - - doesn’t match defined True/False format “T|TRUE|YES|Y|t|true|1|yes|y” / “F|FALSE|NO|N|f|false|0|no|n” in field # 5 of record # 2, value: ‘False’

I have not found a way to allow this specific value to be valid, is there a way, or would my solution be to read this field as string and run it through a Reformat?

tia for any advice/clarification…

Rox

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [August 13, 2010, 12:58pm UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/2 "2010-08-13T12:58:51Z")

</div>

Hello,  
CloverETL 2.9 can’t parse such boolean data. In CloverETL 3.0, that will be released within a few days, you can specify a _true_ as well as _false_ format for boolean data field.

---

<div class="post-metadata">

**Author:** ![dpavlis](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dpavlis](https://forum.cloverdx.com/u/dpavlis)\
**Post date:** [August 17, 2010, 7:55am UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/3 "2010-08-17T07:55:14Z")

</div>

You may also parse the boolean value as a string value first (in Reader) and then in following Reformat component convert it to boolean using simple construct like this (in CTL1):

```auto
$out_boolean:= iif($in_string == "True", true, false);

```

Which means that “True” value become boolean true and everything else will be considered false.

---

<div class="post-metadata">

**Author:** ![crrb](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@crrb](https://forum.cloverdx.com/u/crrb)\
**Post date:** [August 17, 2010, 3:46pm UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/4 "2010-08-17T15:46:21Z")

</div>

thank you for this example of how best to do the conversion.

Strictly a theoretical question: do you know what the differences would be between iif() vs just == ?  
( on the assumption that that inbound data stream really does give exactly “True”, “False”, or NULL for results)

e.g.

$out\_boolean := iif($in\_string==“True”,true,false);  
vs  
$out\_boolean := $in\_string==“True”;

If nobody’s looked specifically - I wouldn’t waste time finding out - but if there are error condition, validity, or performance issues that make a difference - that is worth knowing… thanks.

crrb

---

<div class="post-metadata">

**Author:** ![dpavlis](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dpavlis](https://forum.cloverdx.com/u/dpavlis)\
**Post date:** [August 17, 2010, 8:45pm UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/5 "2010-08-17T20:45:56Z")

</div>

Actually both cases are equal in terms of syntax/semantic validity. The " == " (plain equal) may be a bit faster. You may also use REGEX expression to capture variations of the “true” string.

```auto
$out_boolean := $in_string ~= "(?i)^True.*"; 

```

Which captures any string starting with “True” (lower, upper or mixture cases) and anything after that.

---

<div class="post-metadata">

**Author:** ![crrb](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@crrb](https://forum.cloverdx.com/u/crrb)\
**Post date:** [September 8, 2010, 2:34pm UTC](https://forum.cloverdx.com/t/how-do-i-read-false-into-a-boolean-type-field/734/6 "2010-09-08T14:34:04Z")

</div>

This is a short follow-up for those that haven’t or are not going to v3 any time soon (since Agata indicates that this can be fixed via an option in v3). For version 2.9 at least I discovered quite by accident because of other research that the reader conditions for recognizing boolean values is stored in the _defaultProperties_ file. So if you have a consistent set of values that you are looking for you can avoid the extra step in your graphs by customizing the _defaultProperties_ file. Look for the _Changing Default CloverETL Settings_ under advanced topics.
