Posts by Andrey • 1,884 points
98 posts
-
0
votes1
answer30
viewsQ: rPad or Padright in Fastreport VCL text export
I am developing a layout that will serve as a basis for exporting a standard CNAB 240 or CNAB 400 text file (billets). I was able to generate the information, everything straight. The problem is…
-
0
votes3
answers124
viewsA: Mysql Inner Join... Column error 'Id_occurrence' in field list is ambiguous
select ocorrencia.Id_ocorrencia, nome_foto from ocorrencia inner join fotos on fotos.id_ocorrencia=ocorrencia.id_ocorrencia Missing alias before ID_OCORRENCIA field selection>…
-
0
votes1
answer59
viewsQ: Compilation Directives in BPL s
I have an application developed in Delphi XE7, running on an Oracle server, Windows Server 2012 R2. Our system is modularized into several BPL s. Often the error occurs External Exception C0000006,…
-
2
votes1
answer238
viewsA: Mysql Re-using subquery result
You can do something like the example below: select subquery.resultado, (subquery.resultado * outra_coluna) as teste from tabela left join (select codigo, resultado from tabela limit 1) as subquery…
-
1
votes2
answers251
viewsA: Fdquery what risks to use variable instead of Parameter
I see no risk in using string in place of params. But I see benefits in using parameters, especially if your system is or someday will be ATM. This due to the FireDAC already change for example a…
-
3
votes2
answers727
viewsQ: Reduce Firebird memory consumption when closing Dataset
I have an app Delphi XE7 which rotates on a seat Firebird 2.5. When I open a FDTable with a 10,000 records for example, Firebird server memory consumption increases by about 1 MB. So far so good,…
-
0
votes3
answers3721
viewsA: Wait for Thread to finish to proceed with the code - Delphi
Just like you have a trial called IdHTTP1WorkBegin, you can develop a IdHTTP1WorkEnd, whereas in the past IdHTTP1WorkBegin you can put some features (Controls like buttons and etc) with the Enabled…
-
1
votes2
answers847
viewsA: Format phones in mysql table
If the current formatting is always as you mentioned, it is simple. Just make a replace: update tabela set telefone = replace(telefone,' 51',' (51)') Only the first phone would be without…
-
0
votes3
answers99
viewsA: Take data that is not in the table
Another possibility: SELECT cod FROM login WHERE NOT EXISTS (SELECT 1 FROM pode WHERE pode.cod_usuario = login.cod_usuario)…
-
1
votes1
answer57
viewsA: Show only those that are not common between two querys in mysql
If I understand correctly, just make a NOT EXISTS of the query you don’t want to appear in the result: SELECT nome, centrodb.registoMiDe.Quarto, DataRegisto, Miccao, Tipo1, Dejeccao, Tipo FROM…
-
2
votes1
answer460
viewsQ: Remove Down Arrow from a Combobox
I want to use a TComboBox with the property style = csDropDown as if it were a TEdit. But why use a TComboBox then? Because I only want one feature of it, the AutoComplete. But I want to remove the…
-
3
votes1
answer763
viewsA: Accountant in Fastreport sums more than once, how to solve?
Friend, make use of the if Engine.FinalPass before increasing its variable, with it you can know if it is in the first or according to step and consequently, can increase its variable only once.…
-
1
votes1
answer263
viewsQ: HTML link in Richedit
It would be possible to have a hyperlink in a word or phrase in a RichEdit, while hovering over this link the cursor looks like crHandPoint and by clicking, evidently open the browser with a…
-
2
votes1
answer213
viewsQ: Performance with Exists
A colleague mentioned that by making a EXISTS in SQL, it is recommended to use DISTINCT 1 to improve performance. For example, instead of doing: SELECT * FROM CLIENTES WHERE NOT EXISTS (SELECT…
-
1
votes2
answers448
viewsQ: Hide component in first record (Dbctrlgrid)
Num TDBCtrlGrid I want to hide a component, actually a TPanel only in the first record of dataset. I tried at the event DBCtrlGrid1PaintPanel checking when the Index = 0 but when for example the…
-
2
votes2
answers254
viewsQ: Items in levels within an HTML Combobox. Is it Possible?
Let’s say you want to list in one Combobox items for sale on an e-commerce site. But on this list, I want to first display the category name and below the items. Example: Sports Bicycle Boot…
-
0
votes2
answers838
viewsA: Delphi herring values
You are saving the result with only two decimal places, evidently the subsequent multiplication will take into account only the two houses and consequently will not reach the desired value. As an…
-
0
votes0
answers174
viewsQ: "Mainmenu Designer" in Runtime
In designer mode it is very easy to assemble the main menu of an application with Delphi, and I also know how to assemble a menu via code at Runtime. But what I’m willing to do is enable the end…
-
2
votes2
answers67
viewsA: How to make a Count work by taking only the fields I want?
Put fields that are not aggregation in one group by: select PVN.NFNum, COUNT(distinct CtrlCargaNum) as Qtd from CTRL_CARGA cc INNER JOIN PED_VENDA_NOTA_FISCAL PVN ON cc.EmpCod = PVN.EmpCod where…
-
4
votes1
answer1556
viewsQ: Difference between Transaction.Commit and Transaction.Commitretaining
Using Firedac technology, I want to know exactly the difference between Commit and CommitRetaining. I read in the official documentation of Firedac that Commitretaining keeps the transaction open.…
-
1
votes1
answer41
viewsQ: Fitrar array PHP
I have a PHP array, as illustrated below. I know I can filter them through (foreach, for example) and seeing if a value meets a certain criterion. But there is some simpler and faster way to make…
-
1
votes1
answer520
viewsA: query receive value from another query
With the IB I believe it is not possible. Already with the Firedac is possible through the TFDDataSetReference, on which you can pass the property data of a dataset to another as follows:…
-
1
votes1
answer893
viewsQ: Clientdataset.Disablecontrols is safe?
In a simple routine to feed a Clientdataset, first execute the command ClientDataSet.DisableControls (before the try) and at the end of while (in the finally), execute the command…
-
0
votes2
answers74
viewsA: VIEW and JOIN, return the product, and the value with the latest date!
Try to make the View SQL like this: SELECT p.codigo , p.nome , p.url , pp.valor FROM produto p LEFT JOIN produto_preco pp ON p.codigo = pp.cod_produto WHERE pp.data = (SELECT MAX(data) FROM…
-
2
votes1
answer1739
viewsA: Command update to remove accents from recorded data?
Source: https://stackoverflow.com/a/17045193/6840825 DROP FUNCTION IF EXISTS `remove_accents`; DELIMITER // CREATE FUNCTION `remove_accents`(`str` TEXT) RETURNS text LANGUAGE SQL DETERMINISTIC NO…
-
0
votes1
answer3026
viewsA: Left Join returning only 1 record for each relationship
See if it works: SELECT a."Campo1" , a."Campo2" , a."Campo3" , a."Campo4" , b."Campo1" , b."Campo2" FROM Tabela1 a LEFT JOIN (SELECT MAX(Tabela2."Campo2") AS "Campo2" , Tabela2."Campo1" FROM Tabela2…
-
0
votes1
answer150
viewsA: Why doesn’t this while loop work? (infinite)
View the adjustment by updating the value of the variables after the transfer: I didn’t get to test the code. function transf(){ var container = document.getElementById('container'); var…
-
1
votes1
answer4217
viewsA: Save and Use images in database ( Delphi and Mysql)
Friend, by own experience I strongly suggest you save the images in a directory and save in the database only the path of the directory. Save to database forces growth disorderly bank, difficult…
-
0
votes2
answers799
viewsA: Delphi - Grid does not display all fields of the SQL statement
Good morning, as commented above, it is possible that there are Fields persistent in the dataset.. one way to check is to check in the DFM of your form (where is the dataset) whether there is any…
-
2
votes2
answers211
viewsA: Select only tuples from a table with JOIN
I believe the SQL below solves your problem: SELECT finpag.cod_forn ,sicforn.nome ,finpag.data_pagto ,MAX(finempe.cod_reduzido) AS cod_reduzido ,finpag.num_empenho ,finpag.ano_empenho ,num_liquid…
sql-serveranswered Andrey 1,884 -
2
votes1
answer224
viewsA: Customise DB Grid with web service data
At any event after the data is loaded (maybe at the end of the Search button event) do a for (repeat loop) of grid columns and check by dataset field size (e.g. string(200)), then calculate the…
-
0
votes3
answers103
viewsA: Get the same result from a query with Join
In this case, if I understand your goal correctly, one way is to make a SELECT by having the item table as the main and only source of SELECT data. The open value, search with a SUB-SELECT. You will…
-
2
votes0
answers706
viewsQ: reCaptcha in Delphi application
I’m doing a CNPJ query by the Revenue website in an application. Now they’re using the reCaptcha, then in a Webbrowser allow the user to click on I’m not a robot and after that, the user must click…
-
1
votes2
answers76
viewsA: Problem in consultation with Join
Make a Group by of all non-aggregated fields, the way it is, it’s summing all the orders into a single record: SELECT pedidos_id , pedidos.cliente_id , pedidos.produto_id , clientes.nome AS…
-
0
votes1
answer611
viewsQ: Restore Minimized Application (Login)
I have an application in Delphi that the login screen appears before the main screen is actually created and opened during the Create of Mainform. If user minimize application on login screen and…
-
1
votes1
answer218
viewsA: I want to display data from a foreign key table in my main table, how do I do?
Dude, basically like this, it’s just relationship between tables (Joins): SELECT FILMES.ID , FILMES.NOME , SALA.NOME , SALA.TIPO FROM FILMES LEFT JOIN SALA ON (FILMES.SALA_ID = SALA.ID)…
-
4
votes2
answers857
views -
3
votes1
answer151
viewsA: Concatenate what is equal and separate what is different with MYSQL/PHP
I understood that there are two columns, one for name and one for surname. I am right? If so, it is possible to do so: Make a SELECT DISTINCT of the column name; Scroll through the result of this…
-
1
votes0
answers55
viewsQ: DUMP Mysql based mto large (Blobs)
I need to make a DUMP of a giant base, it has more than 500.000 Pdfs files uploaded into it in a field BLOB. It is possible to make a DUMP from such a base and restores it smoothly? If yes, how to…
-
1
votes1
answer2445
viewsQ: Use Tchromium to make a browser
I want to use the Tchromium to make a browser with Delphi. But I’m not getting access to any page with it. I’ve used the controls: Chromium1.Load('www.terra.com.br'); Also:…
-
0
votes2
answers250
viewsA: Order By in 2 MYSQL tables
Do ORDER BY t5.product_id DESC, so order by the order of registration of the product. The fact that you are not listing all products, must be related to INNER JOINS or even to WHERE. Exchange the…
-
1
votes1
answer101
viewsA: Select printer when printing a Hiercubechart
A friend from work gave me a tip that solved the problem: Add to Unit Vcltee.Teeedigene; Instead of calling the HierCubeChart.Print, call it that: ChartPreview(Self,HierCubeChart);…
-
1
votes1
answer101
viewsQ: Select printer when printing a Hiercubechart
I have the library Hiercube, of this library use a Hiercubechart. So far no problem. But when printing the chart using the command HierCubeChart.Print, I cannot allow the user to select the printer…
-
0
votes2
answers181
viewsA: Package usage difference in Delphi/Lazarus and Java
In Java your concept is correct. In Delphi the use of packages or Packages serves more specifically to modularize a system. However, the organization of classes can be done in these packages as well…
-
1
votes1
answer610
viewsQ: Override user typed key
Num Edit Delphi normal want to undo the key the user typed. If it was at the event KeyPress, quiet, just attribute #0 for the variable key. But I am and accurate use the event KeyDown. In this event…
-
1
votes3
answers113
viewsA: Sum between Mysql lines
select (select * sum(quantidade) from controle_de_estoque where tipoMovimentacao = 0) - (select * sum(quantidade) from controle_de_estoque where tipoMovimentacao = 1) as ESTOQUEATUAL from dual…
-
3
votes3
answers1190
viewsA: Problems with Midaslib
Probably the directory where the Midaslib.pas file is located is not in the Library delphi. Is usually: C:\Program Files (x86)\Embarcadero\Studio\15.0\source\data\dsnap It shall operate from the…
-
0
votes2
answers214
viewsA: Stringgrid Delphi - "carousel"
Control of fetch is never done in a grid, regardless of the same being Dataware or not. The control should be done in the dataset. I assume you must be using the Firedac, thus being in FecthOptions,…
-
3
votes2
answers230
viewsA: Sub-consultations with SELECT declaration in Sqlite
The SQL down below (exactly as is) already brings the result you want: SELECT (select sum(VALOR) from LANCAMENTO where TYPE_RELEASE ='D') as RESULT_D, (select sum(VALOR) from LANCAMENTO where…
-
2
votes4
answers1882
viewsQ: Count substrings within a string
I want to know how many times you leave a string appears within a text, example: In the Microsoft quality is prioritized, therefore the Microsoft is the best. I want a function in which I pass two…