Page 1 of 1

DCBROWSECOL and DATA

Posted: Thu Jan 26, 2017 10:12 am
by Victorio
Hi,

Only little question, about correct syntax, how can I implement here conversion function convtoansiCP() :

DCBROWSECOL DATA SQLFieldBlock(qoDataset,qoDataset:FieldPos("POPIS")) ;
HEADER "Plomba na" WIDTH znakpixc[1]*15

SQLFieldBlock is function from SQL Express...

Or maybe better solution, how can I change charset in SQL Statement, my collation is Slovak_CI_AS :
statement is like this :

problem is with table LCI_PLM.POPIS, because I have in my app SET CHARST TO OEM everythere (DBF files FOXPRO) and table has ANSI coding :

cStatement := 'SELECT KU_ID,CLV,PCS,LIS_KNIHY.ZNA,CPS,ROL,OZN,LIS_KNIHY.CTL,LCI_PLM.POPIS '+;
'FROM LIS_PLOMBA,LIS_PLOMBA_HIS,LIS_KNIHY,LCI_ZNA,LCI_PLM WHERE '+;
'(LIS_PLOMBA.PLO_ID = LIS_PLOMBA_HIS.PLO_ID) AND (LIS_PLOMBA.LIS_ID = LIS_KNIHY.LIS_ID) AND '+;
'(LIS_PLOMBA.CLV='+qcislolv+') AND '+; // filtrovanie pre zadané CLV
'(LIS_PLOMBA.KU_ID='+qcisloku+') AND '+; // filtrovanie pre zadané cislo ku
'(LIS_KNIHY.ZNA=1 OR LIS_KNIHY.ZNA=2 OR LIS_KNIHY.ZNA=3 OR LIS_KNIHY.ZNA=4) AND '+; // V,Z,N,X
'(LIS_KNIHY.STL=1 OR LIS_KNIHY.STL=4 OR LIS_KNIHY.STL=5) AND '+; // povolený,v konaní,v konaní po lehote
'(LIS_PLOMBA.PLM=2 OR LIS_PLOMBA.PLM=3 OR LIS_PLOMBA.PLM=7 OR LIS_PLOMBA.PLM=4 OR LIS_PLOMBA.PLM=5 OR LIS_PLOMBA.PLM=6) AND '+;
'(LIS_PLOMBA.PLS=1 OR LIS_PLOMBA.PLS=2) AND '+; // plomba, dotknutá nehn.
'(LIS_KNIHY.LTY=1) AND '+; // právne listiny (tj. mimo objednávok atď.)
'(LCI_ZNA.ZNA = LIS_KNIHY.ZNA) AND '+; // toto typ listiny zviazanie z typom v KNIHY ? ale neviem presne či dobré
'(LCI_PLM.PLM = LIS_PLOMBA.PLM)' // zobrazenie typu plomby

If I change SET CHARSET TO ANSI, SQL table show correct, but I mean, exist better variant

Re: DCBROWSECOL and DATA

Posted: Thu Jan 26, 2017 12:53 pm
by rdonnay
Put the following debugging in your code so I can see what kind of code block is return by SQLFieldBlock()

WTF SQLFieldBlock(qoDataset,qoDataset:FieldPos("POPIS"))

This will show you what is in the code block.
It can then be modified and you would replace the call to SQLFieldBlock() with the contents of the modified code block.

Re: DCBROWSECOL and DATA

Posted: Thu Jan 26, 2017 1:06 pm
by Victorio
SQLFieldblock is :

FUNCTION SQLFieldBlock( oCursor, nField )
Return {|x|iif(Pcount()==0, oCursor:fieldGet(nField), oCursor:fieldPut(nField, x))}

Modify it is good idea, thanks. I will try.
Also wtf...

I am also searching some info about SQL CONVERT, etc. and set charset ... by SQL statement .

Re: DCBROWSECOL and DATA

Posted: Fri Jan 27, 2017 1:44 am
by Victorio
Hi Roger ,

this works fine :

FUNCTION SQLFieldBlock2( oCursor, nField )
Return {|x|iif(Pcount()==0, iif( !empty(oCursor:fieldGet(nField)) , convtooemCP(oCursor:fieldGet(nField))," ") , oCursor:fieldPut(nField, x))}

Thanks