Grid issues

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Grid issues

Post by Claudio Ricardo »

Hello Friends !!! Sorry for the absence... today it brings me a problem with a grid control !
And I turn for help to the wise men of the forum who have always helped me so much !!!
The first column comes from a MariaDB "Int" field... and grid add decimals only in the first col when len > 1 :o
It had never happened to me... If any have a solution I'll be very greatful !!!
Screenshot_20220901_161932.png
Screenshot_20220901_161932.png (102.95 KiB) Viewed 5032 times
Screenshot of Heidi SQL table "articulos":
Screenshot_20220901_163850.png
Screenshot_20220901_163850.png (11.7 KiB) Viewed 5032 times
And grid definition code:

Code: Select all

			DEFINE GRID Grid_Articulos
				ROW    124
				COL    1
				WIDTH  719
				HEIGHT 517
				ITEMS { {"","","","","","","","","","","",""} }
				VALUE Nil
				WIDTHS { 50,240,80,70,80,80,50,80,80,90,30,50 }
				HEADERS {'C.Int.','Articulo','Costo $','Margen %','Neto $','Imponible $','IVA %','PVP $','Impuesto $','BarCode','V','Rubro'}
				FONTNAME "Arial"
				FONTSIZE 9
				TOOLTIP ""
				ONCHANGE Nil // Grid_Articulos_OnDblClick ()
				ONGOTFOCUS Nil
				ONLOSTFOCUS Nil
				FONTBOLD .F.
				FONTITALIC .F.
				FONTUNDERLINE .F.
				FONTSTRIKEOUT .F.
				ONDBLCLICK Nil // Grid_Articulos_OnDblClick ()
				ONHEADCLICK Nil
				ONQUERYDATA Nil
				MULTISELECT .F.
				ALLOWEDIT .F.
				VIRTUAL .F.
				DYNAMICBACKCOLOR Nil
				DYNAMICFORECOLOR Nil
				COLUMNWHEN Nil
				COLUMNVALID Nil
				COLUMNCONTROLS Nil
				SHOWHEADERS .T.
				CELLNAVIGATION .F.
				NOLINES .F.
				HELPID Nil
				IMAGE Nil
				JUSTIFY { , , GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT, , GRID_JTFY_CENTER, }
				ITEMCOUNT Nil
				BACKCOLOR NIL
				FONTCOLOR NIL
				HEADERIMAGES Nil
				ROWSOURCE Nil
				COLUMNFIELDS Nil
				ALLOWAPPEND .F.
				ALLOWDELETE .F.
				BUFFERED .F.
				DYNAMICDISPLAY Nil
				ONSAVE Nil
				LOCKCOLUMNS 0
			END GRID

Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
martingz
Posts: 408
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Grid issues

Post by martingz »

Claudi i use in grid popierty
COLUMNCONTROLS {aCtrl_3,aCtrl_3,aCtrl_2,aCtrl_2,aCtrl_7}
where
aCtrl_1:={'TEXTBOX','NUMERIC','999,999,999.99'}
aCtrl_2:={'TEXTBOX','CHARACTER'}
aCtrl_3:={'TEXTBOX','NUMERIC','9999999999'}
aCtrl_4:={'DATEPICKER','UPDOWN'}
aCtrl_5:={ 'CHECKBOX' , 'Si' , 'No' }
aCtrl_6:={ 'EDITBOX' }
aCtrl_7:={'TEXTBOX','NUMERIC','99999999.99'}
aCtrl_8:={'TEXTBOX','NUMERIC','999.9999'}
aCtrl_9:={'TEXTBOX','NUMERIC','99999999999999999'}
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Grid issues

Post by Claudio Ricardo »

Gracias Martin por tu rápida respuesta pero este grid no es editable ni lleva controles es sólo para mostrar los artículos.
En el array se vé que es numérico ese item y su valor correcto pero el grid le agrega decimales no sé porqué...

Thank you Martin for your quick response but this grid is not editable nor does it have controls, it is only to display the articles.
In the array you can see that this item and its correct value are numeric, but the grid adds decimals to it, I don't know why...
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Grid issues

Post by Rathinagiri »

If columncontrols are not defined then it is safe to convert the values to string before adding to the grid. If you can send a sample code, we can see what to do.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
jorge.posadas
Posts: 205
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Morelia, Mich. México
Contact:

Re: Grid issues

Post by jorge.posadas »

Claudio
¿Cuál es la estructura de tu tabla?
Cordialmente

POSADAS SOFTWARE
Jorge Posadas Ch.
Programador independiente
Morelia, Mich.
M é x i c o .
Movil +52 44 3734 1858
SKYPE: jorge.posadasch
Email: jorge.posadas@posoft.mx
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Grid issues

Post by dragancesu »

I don't use mysql this day but database is database, try

SELECT round(code,0), articulo, cost ...

or better

SELECT truncate(code,0), articulo, cost ...
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Grid issues

Post by serge_girard »

Anyway: convert to string!

Serge
There's nothing you can do that can't be done...
martingz
Posts: 408
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Grid issues

Post by martingz »

Claudio mi grid tampoco es editable, solo lo uso para desplegar la informacion de la manera que quero, te envie todo el codigo pero mas que nada lo uso para desplegrar tipos numericos

saludos
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Grid issues

Post by Claudio Ricardo »

Thank you all for response !!!
I knew that the first column cannot be justified to the right but I did not know that I would have
problems if I want to load it with a numerical data...

Rathinagiri: I did that to fix it, convert the value to character, see screenshot below.

Jorge: In the second screenshot you can see part of the table opened with Heidi SQL,
the field in question is Integer and the array with which I load the grid shows it like this.

Dragancesu: It didn't work because in the array it already came in numerical format without decimals,
see first screenshot ( MsgDebug(aTable) ), but it gave me the idea of how to solve it.

Serge: Yes... the best idea... "SELECT CONVERT (Code, CHAR), Item, Cost, Margin, Etc. It Work... :P

Martin: I'm going to study your method more time... for now I found a solution...
Screenshot_20220902_122314.png
Screenshot_20220902_122314.png (91.34 KiB) Viewed 4928 times
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Grid issues

Post by dragancesu »

Why not
I knew that the first column cannot be justified to the right
you have [ JUSTIFY <anJustifyValue> ] in GRID definition
Post Reply