# DatabaseRecord

**URL:** <https://forum.xojo.com/t/databaserecord/9548>\
**Category:** Web\
**Created:** [July 15, 2013, 10:22pm UTC](https://forum.xojo.com/t/databaserecord/9548 "2013-07-15T22:22:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 15, 2013, 10:22pm UTC](https://forum.xojo.com/t/databaserecord/9548/1 "2013-07-15T22:22:01Z")

</div>

Dim Db As DatabaseRecord  
Db.IntegerColumn(“activecredit”)=TrueFalse(ChkActive.Value) \<\< this Function Return integer but no works (Parameter are not Compatible with this Function)  
Db.IntegerColumn(“activecredit”)=0 \<\< this Works

---

<div class="post-metadata">

**Author:** ![Mike\_Charlesworth](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/958977/32.png) [@Mike\_Charlesworth](https://forum.xojo.com/u/Mike_Charlesworth)\
**Post date:** [July 15, 2013, 10:41pm UTC](https://forum.xojo.com/t/databaserecord/9548/2 "2013-07-15T22:41:51Z")

</div>

You need to use dB.booleancolumn

---

<div class="post-metadata">

**Author:** ![Mike\_Charlesworth](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/958977/32.png) [@Mike\_Charlesworth](https://forum.xojo.com/u/Mike_Charlesworth)\
**Post date:** [July 15, 2013, 10:46pm UTC](https://forum.xojo.com/t/databaserecord/9548/3 "2013-07-15T22:46:05Z")

</div>

Sorry I typed that last reply on my phone. Try

```auto
Db.BooleanColumn("activecredit")=TrueFalse(ChkActive.Value) 
```

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 15, 2013, 10:57pm UTC](https://forum.xojo.com/t/databaserecord/9548/4 "2013-07-15T22:57:40Z")

</div>

but my data type is small integer on PostgreSQL

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [July 15, 2013, 11:17pm UTC](https://forum.xojo.com/t/databaserecord/9548/5 "2013-07-15T23:17:32Z")

</div>

Take the line apart to see what it is complaining about.

`dim b as boolean = ChkActive.Value
dim n as integer = TrueFalse(b)
Db.IntegerColumn("activecredit") = n
`  
If that works, start building it back up until it breaks.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [July 15, 2013, 11:21pm UTC](https://forum.xojo.com/t/databaserecord/9548/6 "2013-07-15T23:21:03Z")

</div>

What is the definition of your TrueFalse function? What is the type of the parameter passed?  
You have improper definition x data type passed.

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 15, 2013, 11:45pm UTC](https://forum.xojo.com/t/databaserecord/9548/7 "2013-07-15T23:45:34Z")

</div>

1=TrueFalse(“True”) Return 1 integer  
0=TrueFalse(“False”) Return 0 integer

---

<div class="post-metadata">

**Author:** ![Chris\_McGhee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/13edae/32.png) [@Chris\_McGhee](https://forum.xojo.com/u/Chris_McGhee)\
**Post date:** [July 15, 2013, 11:54pm UTC](https://forum.xojo.com/t/databaserecord/9548/8 "2013-07-15T23:54:10Z")

</div>

I would use a function like so:

```auto
Function TrueFalse(Value As Boolean) As Integer
  Dim intReturn As Integer
  
  If Value Then
    // If the value is true, set the return to a 1
    intReturn = 1
    
  Else
    // If the value is false, set the return to a 0
    intReturn = 0

  End If
  
  // Return the number
  Return intReturn
  
End Function

```

Check that your parameter type is a Boolean.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [July 16, 2013, 12:11am UTC](https://forum.xojo.com/t/databaserecord/9548/9 "2013-07-16T00:11:21Z")

</div>

[quote=20281:@Alexis Colon Lugo]1=TrueFalse(“True”) Return 1 integer  
0=TrueFalse(“False”) Return 0 integer[/quote]  
Is the function’s parameter defined as a string or a boolean? You seem to be passing a string here, but in the original code you appear to be passing a boolean value.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [July 16, 2013, 12:33am UTC](https://forum.xojo.com/t/databaserecord/9548/10 "2013-07-16T00:33:40Z")

</div>

```auto
// Pass string, if "True" return 1, anything else return 0
//--------------------------------------------------------
Function TrueFalse(Value As String) As Integer
    If Trim(Value)="True" Then return 1 // True, true, TRUE - Xojo is case insensitive
    Return 0
End Function
```

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 2:08am UTC](https://forum.xojo.com/t/databaserecord/9548/11 "2013-07-16T02:08:52Z")

</div>

hi i use this code  
Function TrueFalse(Value As Boolean) As Integer  
Dim intReturn As Integer

If Value Then  
// If the value is true, set the return to a 1  
intReturn = 1

Else  
// If the value is false, set the return to a 0  
intReturn = 0

End If

// Return the number  
Return intReturn

End Function

same error msg

this is Xojo 2013r1 mac os

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 2:10am UTC](https://forum.xojo.com/t/databaserecord/9548/12 "2013-07-16T02:10:52Z")

</div>

i like the old IDE this my first time using xojo end is slow compare with the old IDE

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 2:13am UTC](https://forum.xojo.com/t/databaserecord/9548/13 "2013-07-16T02:13:56Z")

</div>

is more productive the old IDE then Xojo

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [July 16, 2013, 3:02am UTC](https://forum.xojo.com/t/databaserecord/9548/14 "2013-07-16T03:02:45Z")

</div>

I threw together a mockup of your scenario as you have explained it and it worked without error.

Window1  
– CheckBox named ChkActive  
– Button named PushButton1  
---- Active event of pushbutton1

` dim db as new DatabaseRecord
  db.IntegerColumn("test") = TrueFalse(ChkActive.value)`

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 3:19am UTC](https://forum.xojo.com/t/databaserecord/9548/15 "2013-07-16T03:19:08Z")

</div>

ok

I have no idea that can be.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [July 16, 2013, 3:27am UTC](https://forum.xojo.com/t/databaserecord/9548/16 "2013-07-16T03:27:17Z")

</div>

[quote=20279:@Tim Hare]Take the line apart to see what it is complaining about.

`dim b as boolean = ChkActive.Value
dim n as integer = TrueFalse(b)
Db.IntegerColumn("activecredit") = n
`  
If that works, start building it back up until it breaks.[/quote]

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 3:46am UTC](https://forum.xojo.com/t/databaserecord/9548/17 "2013-07-16T03:46:11Z")

</div>

Same  
Parameter are not Compatible with this Function

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 3:49am UTC](https://forum.xojo.com/t/databaserecord/9548/18 "2013-07-16T03:49:58Z")

</div>

the only way works is like  
If ChkActive.Value=“True” Then  
Db.IntegerColumn(“activecredit”) = 1  
else  
Db.IntegerColumn(“activecredit”) = 0  
end if

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [July 16, 2013, 3:54am UTC](https://forum.xojo.com/t/databaserecord/9548/19 "2013-07-16T03:54:31Z")

</div>

Check this: [http://www.sendspace.com/file/dnpi41](http://www.sendspace.com/file/dnpi41)

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [July 16, 2013, 4:05am UTC](https://forum.xojo.com/t/databaserecord/9548/20 "2013-07-16T04:05:55Z")

</div>

now it works with you code but i have to shutdown xojo and then open and then put you code and it works

thanks

[Next page](https://forum.xojo.com/t/databaserecord/9548.md?page=2)
