DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

data problem

Hello,
 
I am using your SQL Wizard application to load data from a db. The problem is that when I load it into the Data Portal, the Channel 'ANIMAL' which had to be Text format appears as Numeric format.
 
I searched for the reason of this and I found that in line 372 of the file "Extra SQL Functions.vbs":
 
    IF SQL_ColType(j) = 93 THEN    ' DATE/TIME 
      ChType = "DateTime"
      Call ChnAlloc("R3PL4C3_M3", SQL_ResultRows)
      ChNums(j) = CNoXGet(GroupDefaultGet, GroupChnCount(GroupDefaultGet))
      Call SQL_BindChannel(ChNums(j), SQL_ColName(j), "t", DBinfo.DateFormat)     
    ElseIF SQL_ColType(j) = -1 OR SQL_ColType(j) > 8 THEN ' STRING
      ChType = "String"
      Call SQL_BindTextChn(SQL_ColName(j)) ' requires DIAdem 9.01 or later
      ChNums(j) = CNoXGet(GroupDefaultGet, GroupChnCount(GroupDefaultGet))
    Else                           ' NUMERIC
      ChType = "Number"
      Call ChnAlloc("R3PL4C3_M3", SQL_ResultRows)
      ChNums(j) = CNoXGet(GroupDefaultGet, GroupChnCount(GroupDefaultGet))
      Call SQL_BindChannel(ChNums(j), SQL_ColName(j), "n", "")
    End IF ' SQL_ColType(j) 
 
 
I am using v 9.0 and I can't update it now. Could anyone give me any solution or an alternative way?
 
Thank you very much!
 
Nuria
 
I attach the files.
0 Kudos
Message 1 of 4
(3,155 Views)

Hi Nuria,

I wrote the SQL_Wizard application you are using initially in DIAdem 9.0.  The first versions had a provision to bind Text columns to global DIAdem text variables and insert a placeholder numeric channel of the same name with index values showing the length of the invisible global variable.  This is one option for you, and it will work fine if you just want to show that text column in a REPORT table, say.

The other option is to create a new empty text channel with ChnAlloc(), set the length to the correct value with ChnLength(), then write in the values cell by cell from SQL_Result() using ChT().  This is slower, but you will have what you probably really want-- an honest-to-goodness text channel with the text column values in it.

Ask if you need additional assistance,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,143 Views)
Hi Brad,
 
Just showing the text column in a report table is exactly what I want, even not the completely table but a piece of it (usually only the first value). The problem is that I can't set the global variables. How can I do it to show the text column in a report table?
When I load this channel to the Data Portal it gives me the following error: Falscher Spaltenname in BindCol, could this be the reason?
 
Thank you,
 
Núria
0 Kudos
Message 3 of 4
(3,140 Views)

Hi Nuria,

If all you want is to show the text column in a REPORT table, then you can just bind the text column to a new global DIAdem string array variable with the following command:

Call SQL_BindVar(SQL_ColName(i), SQL_ColName(i), "F", "Single")

Now you can add a column to your REPORT table of type "Variable" (instead of "Channel" or "Expression").

Ask if you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 4
(3,125 Views)