Reading CSV file

  1. 3 months ago

    Reading a CSV file.
    In the CSV file the boolean fields come as 1 or 0, is there a better way to read them that:
    if (NthField(rowFromFile,chr(asciiSeparator), 3).Val) = 1 then t.blocking = true

  2. Javier M

    Jun 12 Pre-Release Testers, Xojo Pro, Third Party Store AprendeXojo - Europe, Spain
    Edited 3 months ago

    You also can write that line using the ternary "if" operator:

    t.blocking = if (NthField(rowFromFile,chr(asciiSeparator), 3).Val = 1, true, false)

    Javier

  3. Edited 3 months ago

    Thanks, I was wondering if there was an operator like .Val, or .Boolean like
    Globals.ASWFinished = rs.Field("ASWFinished").BooleanValue

  4. Javier M

    Jun 12 Pre-Release Testers, Xojo Pro, Third Party Store AprendeXojo - Europe, Spain

    Well, in that case you can apply the technique exposed in this forum thread (the one based on a Module creation with a class method extension).

    Javier

  5. Norman P

    Jun 12 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Enric H Reading a CSV file.
    In the CSV file the boolean fields come as 1 or 0, is there a better way to read them that:
    if (NthField(rowFromFile,chr(asciiSeparator), 3).Val) = 1 then t.blocking = true

    the CSV Parser from me :P
    http://www.great-white-software.com/Xojo_Code.html

or Sign Up to reply!