DatabaseRecord

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

You need to use dB.booleancolumn

Sorry I typed that last reply on my phone. Try

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

but my data type is small integer on PostgreSQL

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.

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

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

I would use a function like so:

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.

[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.

// 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

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

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

is more productive the old IDE then Xojo

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)

ok

I have no idea that can be.

[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]

Same
Parameter are not Compatible with this Function

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

Check this: http://www.sendspace.com/file/dnpi41

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

thanks