Android Question +++ LOG: entry corrupt or truncated

AHilberink

Active Member
Licensed User
Longtime User
Hi,

Can someone tell me why I got this?

B4X:
    If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"
Log(edtTonnen.Text)

Best regards,
André
 

Sandman

Expert
Licensed User
Longtime User
I have no idea what you're actually asking, you might want to put more energy into your posts so it's easier to understand them.

That said, you're using ==, which isn't supported. Perhaps that's the cause for whatever problem you're experiencing?
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
I have no idea what you're actually asking, you might want to put more energy into your posts so it's easier to understand them.

That said, you're using ==, which isn't supported. Perhaps that's the cause for whatever problem you're experiencing?

can you post the full error logs

Hi Sandman and Ronell,

Sorry for the short message, but this is all I have about this. The message appears in the right part (steps during running) of B4A because of the LOG(edtTonnen.Text). Instead of giving the value, it gives this message.

I tried also:
B4X:
edtTonnen.Text="0.0"
Log(edtTonnen.Text)

and got the same LOG result.

I use another EditText control at the same way and had no problem at all.

It looks like the value of edtTonnen.Text is way to long, but I am unable to reset as you can see in the code above.

I hope I can find the reason.

Best regards,
André Hilberink
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
what is edtTonnen.Text. How it's defined and where.

Ciao
Mauro


Hello Mauro,

Here are the parts linked to edtTonnen.Text:
B4X:
Sub Globals
    Private edtTonnen As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If(edtTonnen.IsInitialized==False) Then edtTonnen.Initialize("")
    IME.Initialize("IME")
   
    IME.SetCustomFilter(edtTonnen, edtTonnen.INPUT_TYPE_NUMBERS, "0123456789.")
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub Activity_KeyPress(KeyCode As Int) As Boolean
End Sub

Sub Start
    Activity.LoadLayout("Formulier.bal")
End Sub

Sub ShowEntry(EntryIndex As Int)
    Dim Cursor1 As Cursor
   
    If (Mode = "Add") Then
        edtTonnen.Text = ""
        Else
            edtTonnen.RequestFocus
        End If
    Else
        'read the entry with the given ID
        Cursor1 = Main.SQL1.ExecQuery("SELECT * FROM "&Main.DBWerktijden&" WHERE ROWID = "&EntryIndex)
        Cursor1.Position = 0
        edtTonnen.Text = Cursor1.GetString("Tonnen")
        Cursor1.Close                                            'close the cursor, we don't it anymore
    End If
End Sub

Sub AddEntry
    Dim Query As String
   
    If(Opdrachtgever.Text&edtLaadplaats.Text&ATLaad.Text&VTLaad.Text&edtAard.Text&edtLosplaats.Text&ATLos.Text&VTLos.Text&edtTonnen.Text&edtM3.Text&edtVrachten.Text<>"") Then
        If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"
        If(edtM3.Text.Trim=="") Then edtM3.Text="0.0"
        If(edtVrachten.Text.Trim=="") Then edtVrachten.Text="0"
        Log(edtTonnen.Text)  'ERROR PART
        Log(edtM3.Text)    'WORKS FINE
        Log(edtVrachten.Text)    'WORKS FINE
        Query = "INSERT INTO "&Main.DBWerktijden&" VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
        Main.SQL1.ExecNonQuery2(Query, Array As String(ActiveROWID,Opdrachtgever.Text,edtLaadplaats.Text,ATLaad.Text,VTLaad.Text,edtAard.Text,edtLosplaats.Text,ATLos.Text,VTLos.Text,edtTonnen.Text,edtM3.Text,edtVrachten.Text,""))
        Main.SQL1.ExecNonQuery("UPDATE ["&(Main.DBTonnen)&"] SET [WerktijdID] = "&Main.SQL1.ExecQuerySingleResult("SELECT last_insert_rowid();")&" WHERE WerktijdID=0")
   
        ToastMessageShow("Invoer verwerkt", False)    ' confirmation for the user
    End If
End Sub

Sub edtM3_TextChanged (Old As String, New As String)
    If (New <> "") Then
        edtTonnen.Text=""
        edtTonnen.Enabled=False
    Else
        edtTonnen.Enabled=True
        edtVrachten.Text=""
    End If
End Sub

Sub ControleRit As Boolean
    If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"
    Log(edtTonnen.Text)  'ERROR PART
End Sub

This is not the complete working code, but all linked to edtTonnen.

Thanks all for helping.

Best regards,
André Hilberink
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
If(Opdrachtgever.Text&edtLaadplaats.Text&ATLaad.Text&VTLaad.Text&edtAard.Text&edtLosplaats.Text&ATLos.Text&VTLos.Text&edtTonnen.Text&edtM3.Text&edtVrachten.Text<>"") Then

Unless I am mistaken, you are building a long string here from all the different parts. This could be too long and generates the error. I think you want to use the AND function, otherwise the IF will always execute as long as one field has text.

If(edtTonnen.Text.Trim=="") Then edtTonnen.Text="0.0"

As reported in post#2, this is also wrong. Should be:

B4X:
If(edtTonnen.Text.Trim="") Then edtTonnen.Text="0.0"

But it may be better to check for a zero value and correct. Just my two pennies worth.
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I discover the reason:
If the value is empty, the LOG will be empty. Changing the Log to:
B4X:
LOG("1:"&edtTonnen.Text)
gives as logresult 1: instead of the strange message.

I don't know why and I never saw this before.
So it seems just an internal event, the application is working fine now.

Thanks all for helping.

Best regards,
André
 
Reactions: eps
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…