Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Thomas Bock

#1
ODBC / count distinct not working
May 22, 2024, 06:57:37 AM
I receive an error 15 with

select count(distinct columnName) from table

msg(-1)=37000: [PxPlus][SQL ODBC Driver]Expected lexical element not found: <identifier>

How can I count distinct column values using ODBC 7.0.3?
#2
Programming / Re: strange error 61
April 16, 2024, 10:24:31 AM
This is a WindX session and the security options are properly set.
The error occures at random. But how can that be? The file has just been created, so PxPlus must be able to open it.
#3
Programming / strange error 61
April 16, 2024, 04:35:17 AM
I don't understand why the code below throws an err 61 sometimes


BUSY_FILE_NAME$ = "[lcl]Busy.txt"
serial BUSY_FILE_NAME$, err = *next
if tcb(2) {
rem in case the file could not be created ...
} else {
busyFile = hfn
open lock (busyFile) BUSY_FILE_NAME$
rem this throws error 61 ???
}
#4
Programming / Re: accessing mySQL-DB
March 25, 2024, 04:57:34 AM
Are there any new insights?
#5
Programming / Re: accessing mySQL-DB
March 18, 2024, 04:25:53 AM
The customer uses openSUSE Leap 15.5
We use a Gentoo and can reproduce the issue
#6
Programming / Re: accessing mySQL-DB
March 14, 2024, 02:52:19 AM
That's what I'm saying.
But the issue comes with version 3.2.7.
#7
Programming / accessing mySQL-DB
March 13, 2024, 11:19:19 AM
We encounter problems with a newer version of libmariadb.so.3
PxPlus 20.10 is installed on a Linux server.
The program below runs with version 3.1.13 on a Linux server. With version 3.2.7 the result is empty and msg(-1) returns "MYSQL:0:".

begin
dbOpt$ = "SERVER=my_server;USER=my_account;PASSWORD=my_password;DATETIME_CONVERT=N"
dbName$ = "[MYSQL]my_database;;"
channel = hfn
open (channel, OPT = dbOpt$, tim = 10) dbName$
query$ = "SELECT * FROM `myTable` limit 1"
write record (channel)query$
gosub buildPVXIOList
repeat
read record(channel,err=*next)sqlResultItem$
if tcb(2) {
print msg(err)
print msg(-1)
break
}
print ++c,": ",sqlResultItem$
until 0
close( channel)
end
buildPVXIOList:
local sqlIOL$    = ken(channel, ind = 3)
local pvxIOL$    = "IOLIST "
local separator$ = $$
local items      = pos(";" = sqlIOL$, 1, 0)
local counter    = 0
local virtual    = 0
repeat
fieldDefinition$ = arg(sqlIOL$, counter + 1, ";")
read data from fieldDefinition$, sep = "," to fieldName$, fieldType$
fieldName$  = tbl(nul(fieldName$), fieldName$, "_VIRTUAL" + str(++virtual))
pvxIOL$    += separator$ + fieldName$
if (mid(fieldType$, 1, 3) = "CHR") or (fieldType$ = "DATE") {
pvxIOL$ += "$"
}
separator$ = ","
until (++counter > items)
pvxIOL$ = sub(pvxIOL$, "-", "_")
dim sqlResultItem$ : cpl(pvxIOL$)
return


What needs to be done in order to work with then newer version?
#8
Wish List / constantly visible scrollbar buttons
December 15, 2023, 07:22:06 AM
With Windows 11 the scrollbar buttons are only visible, if the mouse hovers over them. This makes the buttons of a spinner control invisible. We like to have constantly visible scrollbars and/or buttons as it used to be. MS-Outlook shows it can be done.
#9
Thin Client/WindX / Re: Auto Updater
December 14, 2023, 03:54:20 AM
Take a look at the static download. You need to do some configuration.
#10
Programming / Re: temporary error 11
December 13, 2023, 10:05:07 AM
Here is another one, which throws an error 11 every now and then without need.

KEYED "M50002",[1:1:1]+[1:2:8]+[1:10:4]+[1:21:20]+[1:14:7],[1:21:20]+[1:1:1]+[1:2:8]+[1:10:4],[1:41:3]+[1:44:10]+[1:21:20]+[1:1:1]+[1:2:8]+[1:10:4],[1:54:10],0,-512,BSZ=4,OPT="0",SEP=$8A$

It is a VLR file.
#11
Programming / Re: create a pivot table
December 01, 2023, 04:24:13 AM
SOLVED!

The trick is to use piTable'dataFields()

lastItem = piTable'dataPivotField'pivotItems()'count
lastPiField = piTable'dataFields(lastItem)
lastPiField'function = -4106
lastPiField'numberFormat$ = mask$
lastPiField'caption$ = title$
#12
Programming / create a pivot table
November 30, 2023, 02:57:10 AM
Has someone created a Pivot table with an average column so far?
I recorded a macro in MS-Excel

    With ActiveSheet.PivotTables("Pivot1").PivotFields("Percent")
        .Caption = "Average %"
        .Function = xlAverage
    End With


This is my translation to PxPlus

pivotName$ = "Pivot1"
fieldName$ = "Percent"
title$ = "Average %"
piTable = sheet'pivotTables(pivotName$)
piField = piTable'pivotFields(fieldName$)
piTable'addDataField(*piField)
lastItem = piTable'dataPivotField'pivotItems()'count
lastPiField = piTable'dataPivotField'pivotItems(lastItem)
lastPiField'caption$ = title$
piField'function = -4106 ! xlAverage


I always receive an error 88 on the last line.
The macro seems to be wrong, because the caption can only be set on lastPiField instead of piField.
Help is appreceated.
#13
Programming / Re: temporary error 11
November 29, 2023, 07:43:17 AM
KEYED "BA_TEXT",[1:1:10]+[2:1:3],0,-256,BSZ=4,OPT="2",SEP=$8A$

IOLIST TEXT_NR$,LFD_NR$,TEXT$

TEXT_NR$ delimited 10
LFD_NR$ delimited 3
TEXT$ delimited 80

#14
Programming / temporary error 11
November 29, 2023, 02:50:34 AM
On customer sites we encounter temporary error 11 on ky$=key(channel,kno=0,end=*next). When we try to reproduce the errors on these systems then the errors are gone. A change to "err=*next" is no option, because that would hide a corrupted file.

What is the reason for these errors 11?
#15
Wish List / string interpolation
November 15, 2023, 08:45:15 AM
In C# there is the possibility to build strings by referencing/including variables.

string name = "Tom";
var date = DateTime.Now;
Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");


These strings are much more readable than coding a concatenation of several small strings. E.g. building a SQL-statement becomes more straight forward.
If PxPlus would provide such functionality, we could gain speed, because the interpreter would not need to translate several lines of code.