Problem with Grid

Moderator: Rathinagiri

Post Reply
radohabjan
Posts: 99
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Problem with Grid

Post by radohabjan »

Hello,

Finally I want to change all Browse command to Grid, but I found a problem with opening database in procedure test ( open with doubleclikc) (HMG 3.0.30 on Win 7 Enterprise 32 bit):


#include "hmg.ch"

Function Main

DEFINE WINDOW predrac ;
AT 20,20 ;
WIDTH getdesktopWidth()-50 ;
HEIGHT getDeskTopHeight()-120 ;
TITLE 'Test' ;
MAIN

select 1
use gl_pred alias gl_pred
go top
select 2
use naslovi alias naslovi
select 1
go top

@ 65,5 GRID Grid_pred ;
WIDTH getdesktopWidth()-70 ;
HEIGHT getDeskTopHeight()-250 ;
HEADERS { 'Štev.','Šifra','Ime kupca','Datum','Znesek','Rabat','DDV','Zaslužek','Znesek za plačilo',;
'Dod.stroški','Datum plačila','Valuta','Knjižen','Status','Plačano po','predračunu',;
'Vrsta','Zav.za davek'} ;
WIDTHS { 50,50,240,100,90,90,90,90,100,90,100,50,50,50,90,80,40,40 } ;
ROWSOURCE "GL_PRED" ;
COLUMNFIELDS { 'STEV','SIFRA','NASLOVI->NAZIV','DATUM','transform(round(rabat,2),"@E 99,999,999.99")',;
'transform(round(rabat,2),"@E 9,999,999.99")','transform(round(davek,2),"@E 9,999,999.99")',;
'transform(round(prep,2),"@E 9,999,999.99")','transform(round(skupaj,2),"@E 9,999,999.99")',;
'transform(round(ptt,2),"@E 9,999,999.99")','DATUM_PLA','VALUTA','KNJ','STATUS','transform(PLACANO,"@E 9,999,999.99")','PRED',;
'substr(KON,2,1)', 'substr(naslovi->KOM2,46,1)' } ;
JUSTIFY { BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,;
BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,;
BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT };
TOOLTIP 'Seznam predračunov' ;
ON DBLCLICK test() ;
FONT 'ARIAL' SIZE 10 ;

END WINDOW
CENTER WINDOW predrac
ACTIVATE WINDOW predrac
close databases
return

procedure test()
select naslovi
msginfo("test")
select gl_pred
return

Best regards Rado
Attachments
TESTGRID.ZIP
(698.48 KiB) Downloaded 313 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problem with Grid

Post by Roberto Lopez »

Thanks for the report.

I'll review it ASAP.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problem with Grid

Post by Roberto Lopez »

radohabjan wrote: Finally I want to change all Browse command to Grid, but I found a problem with opening database in procedure test ( open with doubleclikc) (HMG 3.0.30 on Win 7 Enterprise 32 bit):
This is not a bug.

No default workarea is assumed to process expressions, so, if you use fields inside expressions, you must aliase it.

In your case DAVEK, PREP, SKUPAJ, PTT, PLACANO and KON must be aliased with GL_PRED->.

So, the correct 'ColumnFields' line is:

Code: Select all

			COLUMNFIELDS { 'STEV','SIFRA','NASLOVI->NAZIV','DATUM','transform(round(rabat,2),"@E 99,999,999.99")','transform(round(rabat,2),"@E 9,999,999.99")','transform(round(GL_PRED->davek,2),"@E 9,999,999.99")','transform(round(GL_PRED->prep,2),"@E 9,999,999.99")','transform(round(GL_PRED->skupaj,2),"@E 9,999,999.99")','transform(round(GL_PRED->ptt,2),"@E 9,999,999.99")','DATUM_PLA','VALUTA','KNJ','STATUS','transform(GL_PRED->PLACANO,"@E 9,999,999.99")','PRED','substr(GL_PRED->KON,2,1)', 'substr(naslovi->KOM2,46,1)' } ;
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
radohabjan
Posts: 99
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Re: Problem with Grid

Post by radohabjan »

Thanks Roberto for the help.

I knew, that this was not a bug, but my bad knowledge.
But now I can switch all browse with grid. I hope that this was the last problem.

Best regards Rado
Post Reply