Recent

Author Topic: [SOLVED] Stored True and False in one string separating them  (Read 602 times)

madref

  • Hero Member
  • *****
  • Posts: 681
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
[SOLVED] Stored True and False in one string separating them
« on: February 02, 2019, 10:10:53 am »
I store a few true and false statements in one string where 1 = true and 0 = false in my database.
In Lazarus you can individual target a single letter in a string with
Code: Pascal  [Select]
  1. MyChar := MyString[1];
In SQLite you can change the name of a field with the 'AS'-statement


Is it possible to separate them in individual statements in SQLite?


I was thinking along
Code: SQL  [Select]
  1. SELECT RS_Observed [1] AS Referee1, RS_Observed [2] AS Referee2, RS_Observed [3] AS Linesman1, RS_Observed[4] AS Linesman2 FROM tbl_Observations
« Last Edit: February 02, 2019, 10:19:21 am by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

madref

  • Hero Member
  • *****
  • Posts: 681
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Stored True and False in one string separating them
« Reply #1 on: February 02, 2019, 10:19:02 am »
Next time i should google first.


Found my own solution again  :D
USE SUBSTR (X,Y,Z) for more info looks here


Code: SQL  [Select]
  1. SELECT SUBSTR(RS_Waargenomen,1,1) AS Referee1, SUBSTR(RS_Waargenomen,2,1) AS Referee2, SUBSTR(RS_Waargenomen,3,1) AS Linesman1, SUBSTR(RS_Waargenomen,4,1) AS Linesman2  FROM tbl_Rapport_Straffen
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave