SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Fredrick Ughimi on October 30, 2018, 07:09:24 am

Title: SQLitening & RMChart
Post by: Fredrick Ughimi on October 30, 2018, 07:09:24 am
Hello Everyone,

Has anyone here worked with SQLitening & RMChart?

I am currently looking to the possibility of creating charts from SQLitening Data.

Title: Re: SQLitening & RMChart
Post by: Fim on November 03, 2018, 06:00:36 pm
RMchart is an excellent product, but .....
It's dead, no further development, wondering if the product's author is still alive.
/Fim
Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 04, 2018, 03:56:42 pm
Hello Fim,

Quote
RMchart is an excellent product, but .....
It's dead, no further development, wondering if the product's author is still alive.


RMChart is here and still being actively used other by programming platforms like XBase++
http://www.brothersoft.com/rmchart-35638.html
Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 04, 2018, 03:58:13 pm
Hello Everyone,

I think RMChart is pretty straight forward. Its just reading the values from SQLitening as double array that is where I am stuck.

From RMChart sample: '****** Read data values ******


REDIM aData(0) AS DOUBLE
REDIM aData(4)
aData(0) = 30 : aData(1) = 40 : aData(2) = 70 : aData(3) = 60 : aData(4) = 20


How do I translate the above, reading from SQLitening table? I have tried using slSelAry, it uses string array, but RMChart requires double array. I really stuck and I need some help.

Thank you in advance.
Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 04, 2018, 08:48:50 pm
This is verbose, limiting and not flexible, but it works.


'****** Read data values ******
    REDIM aData(4)
    LOCAL dTemperature1 AS DOUBLE
    LOCAL dTemperature2 AS DOUBLE
    LOCAL dTemperature3 AS DOUBLE
    LOCAL dTemperature4 AS DOUBLE
    LOCAL dTemperature5 AS DOUBLE
    slSEL "SELECT Temperature as ITemperature1 FROM tblObservationChart LIMIT 1"
    IF ISTRUE slGetRow() THEN
       dTemperature1 = VAL(slFN("ITemperature1"))
    END IF
    slCloseSet

    slSEL "SELECT Temperature as ITemperature2 FROM tblObservationChart LIMIT 2, 1"
    IF ISTRUE slGetRow() THEN
       dTemperature2 = VAL(slFN("ITemperature2"))
    END IF
    slCloseSet

    slSEL "SELECT Temperature as ITemperature3 FROM tblObservationChart LIMIT 3, 1"
    IF ISTRUE slGetRow() THEN
       dTemperature3 = VAL(slFN("ITemperature3"))
    END IF
    slCloseSet

    slSEL "SELECT Temperature as ITemperature4 FROM tblObservationChart LIMIT 4, 1"
    IF ISTRUE slGetRow() THEN
       dTemperature4 = VAL(slFN("ITemperature4"))
    END IF
    slCloseSet

    slSEL "SELECT Temperature as ITemperature5 FROM tblObservationChart LIMIT 5, 1"
    IF ISTRUE slGetRow() THEN
       dTemperature5 = VAL(slFN("ITemperature5"))
    END IF
    slCloseSet
    aData(0) = dTemperature1 : aData(1) = dTemperature2 : aData(2) = dTemperature3 : aData(3) = dTemperature4 : aData(4) = dTemperature5


Any better suggestions would be appreciated.

Best regards.
   
Title: Re: SQLitening & RMChart
Post by: cj on November 04, 2018, 10:39:12 pm
#INCLUDE "sqlitening.inc"

FUNCTION PBMAIN () AS LONG
LOCAL x,elements AS LONG

slOpen "junk.db3","C"
slexe "drop table if exists table1
slexe "create table if not exists table1(temperature integer)"
slexe "insert into table1(temperature)values(30),(40),(70),(60),(20),(17),(88)"

REDIM sArray(0) AS STRING
slSelAry "select temperature from table1",sArray(),"Q9"

'read each value into the aData array subscript.
elements = UBOUND(sArray)
IF elements > 0 THEN
  REDIM aData(elements) AS DOUBLE
  FOR x = 1 TO elements
   aData(x-1) = VAL(sArray(x))
  NEXT
END IF
END FUNCTION

Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 05, 2018, 10:33:25 am
Hello CJ,

Excellent. Thanks for the sample code. The problem is how do I individually read each values into the
aData array subscripts.

aData(0) = ? : aData(1) = ? : aData(2) = ? : aData(3) = ? : aData(4) = ?

Best regards.

Title: Re: SQLitening & RMChart
Post by: cj on November 05, 2018, 11:21:28 am
Quote
Excellent. Thanks for the sample code. The problem is how do I individually read each values into the
aData array subscripts.
aData(0) = ? : aData(1) = ? : aData(2) = ? : aData(3) = ? : aData(4) = ?


The code did this so don't understand the question?   
aData(0) = row 1 temperature as a DOUBLE
aData(1) = row 2 temperature as a DOUBLE
aData(2) = row 3 temperature as a DOUBLE
aData(3) = row 4 temperature as a DOUBLE
aData(4) = row 5 temperature as a DOUBLE

REDIM sArray(0) AS STRING
slSelAry "select temperature from table1 LIMIT 5",sArray(),"Q9"
elements = UBOUND(sArray)
IF elements > 0 THEN
REDIM aData(elements) AS DOUBLE
FOR x = 1 TO elements
  aData(x-1) = VAL(sArray(x)) read each value into the aData array subscript.
NEXT
END IF
Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 05, 2018, 11:44:22 am
Yes. I understand the values are read into aData array.

aData(x-1) = VAL(sArray(x)) read each value into the aData array


Just that the values in my table doesn't reflect what the Chart says. Maybe I am doing something wrong. I would check.

Thanks a lot.
Title: Re: SQLitening & RMChart
Post by: Fredrick Ughimi on November 05, 2018, 02:53:47 pm
Hello CJ,

I mistakenly was changing the values of the same Database in another directory. My mistake.

Works great! Thanks once again.