[SOLVED] SQLite and 2 decimals lazarus / 16-Databases ---------------------------------------------------------------------- madref · 2016-03-10 20:14 I am using this SQL-statement to create a query/view. Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT Wed_Meetellen, Scheidsrechter AS Referee, COUNT(Scheids_ID) AS Games, SUM(Vergoeding_Wed) AS Fee, SUM(Vergoeding_KM) AS MilageFROM qry_Temp_UitbetalenWHERE ABS(Wed_Meetellen) = 1GROUP BY ScheidsrechterORDER BY Scheidsrechter;  This outlines all the numbers on the right and i have decimal numbers like 100.1 I want to have to digits after the point (like 100.10). With the following code i can get the 2 digits decimals but it lines the column out to the left side. Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT Wed_Meetellen, Scheidsrechter AS Referee, COUNT(Scheids_ID) AS Games,printf("%.2f",SUM(Vergoeding_Wed)) AS Fee,SUM(Vergoeding_KM) AS MilageFROM qry_Temp_UitbetalenWHERE ABS(Wed_Meetellen) = 1GROUP BY ScheidsrechterORDER BY Scheidsrechter; Question: How can i get a 2 digit decimal AND the column is outlined to the right? ---------------------------------------------------------------------- balazsszekely · 2016-03-11 04:05 For each field in the query you have a DisplayFormat property + the OnGetText event. Use one of those to format the output. Even more, you have the Alignment property to change the alignment(left, center, right). ---------------------------------------------------------------------- madref · 2016-03-11 04:43 I have the following DBGrid and its linked to the rest. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     DBGrid_Evaluaties: TDBGrid;    DS_Evaluaties: TDataSource;     TQ_Evaluaties: TSQLQuery;  Could you give me an example because i don't know how to address both ---------------------------------------------------------------------- balazsszekely · 2016-03-11 05:19 I don't know how can I be more specific: https://youtu.be/n4WW5XxLsMc PS: For formating use the DisplayFormat or the OnGetText event not both. ---------------------------------------------------------------------- madref · 2016-03-11 06:21 Yes.. now i see.... But this is all in design time. I am making my query in runtime so i don't have the fields at design time. This is my code..... But then i am stuck Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TQ_Evaluaties.Active := False;  cSQL := 'SELECT ' +          'Wed_Meetellen, Scheidsrechter AS Referee, COUNT(Scheids_ID) AS Games, ' +          'SUM(Vergoeding_Wed) AS Fee, ' +          'PRINTF("%.2f", SUM(Vergoeding_KM)) AS Milage ' +          'FROM qry_Temp_Uitbetalen ' +          'WHERE ABS(Wed_Meetellen) = 1 ' +          'GROUP BY Scheidsrechter ' +          'ORDER BY Scheidsrechter;';  TQ_Evaluaties.DataBase := Form_Information.Connect_RefereeDB;  TQ_Evaluaties.SQL.Text := cSQL;  TQ_Evaluaties.Active := True; ---------------------------------------------------------------------- balazsszekely · 2016-03-11 06:42 You can also access those properties at runtime: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    TQ_Evaluaties.Fields[I].Alignment := taLeftJustify;  Label1.Caption := Format('...', TQ_Evaluaties.FieldByName('Vergoeding_Wed').AsFloat); ---------------------------------------------------------------------- mangakissa · 2016-03-11 08:16 It's not really created in runtime Bu I know what you mean. Also in runtime you can format your decimals Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TFloatfield(TQ_Evaluaties.FieldByName('Vergoeding_Wed')).Displayformat := '####0.00'; ---------------------------------------------------------------------- madref · 2016-03-12 18:47 Thanx everyone