Hello Sparrow,

I've already made that. All the information is already in Mysql.
It seems that I had a problem with my SQL Query. I've solved it partially.

The thing is now, that the date conversion is not OK.
I have this conversion

frmAsociereOrdine.dtpDataStart.DateTime := SQLDateTimeToDateTime(detOrdin.FieldByName('DataStart').asString);

but the system is throwing an error message : EConvertError "07/08/2023" is not a valid date and time.

How can I solve that?

Alin

Hello once again,

I have moved my database from SQLite to MYSQL and now the TDataSet is not populating any fields (textboxes / comboboxes). I am not getting any errors, only that the fields are blank.
How can I solve this to work with Mysql as well? Is there another approach?

Thank you.
Alin

sparrow wrote:

Something like this

Hi sparrow,

You're a life saver!
Thank you so much.

Best regards,
Alin

Hello all,

I encounter a problem now with the SQLQuery. I have textboxes, comboboxes and checkboxes to asign values to.
For textboxes, it's clear, I have string values, for comboboxes i used integer but I can't figure it out how to asign the values to the checkboxes. I tried also with Integer , string or boolena but is not working.
Can somebody help me to asign the value to the checlbox as well?

Thank you.

BR,
Alin

Hi sparrow,

You're a life saver!
This is what I wanted to achieve, but haven't known how to do it.
Thank you so much for pointing that out!

BR,
Alin

Hello tcoton,

You're right, but this SELECT statement is for the search form and it populates a tablegrid.
NOw, from this table grid, I would like to create a Select statement and send the information to the edit form based on ID.
When the ID is passed to the edit form, there I have to create a bunch o Select statement for each textbox to hold the values.

I was thinking that maybe is a possibility to create a single SELECT statement which holds all the information and then to assign to the textboxes. I have read something about Recordset, but I am not sure how to do it.

Thank you.

BR,
Alin

Hi all,

I need your assistance.
I would like to create a query to populate several textboxes based on the selected record from a table grid.

I tried for each textbox to write an SQLExecute query, which is working just fine, but I think there should be am easier way.

The structure of my table is:
tblRetete:
-id = integer
-id_tblTipReteta=integer FK
-Activ = boolean
-id_tblArticol = integer FK
-id_tblArticol1=integer FK
-Cantitate

tblArticol contains all the materials (Finished Goods, Row Material)

To select the records, I've created this Select statement, which populate a tablegrid and is working fine:

procedure cautaReteta (Sender: TObject; var Cancel: boolean); // cauta reteta
var
ca, na, cc, nc, nr , tr : String;
sr, cf: integer;

begin
ca:= TRIM(frmMain.txtCodArticolReteta.Text);
na:= trim(frmMain.txtNumeArticolReteta.Text);
cc:=TRIM(frmMain.txtCodComponentaReteta.Text);
nc:=TRIM(frmMain.txtNumeComponentaReteta.Text);
nr:=frmMain.txtNumeReteta.Text;
tr:=SQLExecute('SELECT TipReteta from tblTipReteta');
//sr:=frmMain.chkStatut.State := cbChecked;

   frmMain.grdRetete.dbSQL:=('SELECT NumeReteta,NrTipReteta,CantRef,CASE Activ when 1 THEN "DA" when 0 THEN "NU" End ,a.CodArticol, a.NumeArticol, ' +
                                   ' CASE Comisionare when 1 then "DA" when 0 then "NU" End,c.CodArticol, c.NumeArticol, ' +
                                   ' Cantitate, CASE Fix when 1 then "DA" when 0 then "NU" End from tblRetete r' +
                                   ' INNER JOIN tblArticol a on r.id_tblArticol=a.id ' +
                                   ' INNER JOIN tblArticol c on r.id_tblArticol1=c.id ' +
                                   ' INNER JOIN tblTipReteta tr on r.id_tblTipReteta=tr.id ' +
                                   ' WHERE a.CodArticol like "%' + ca + '%"' +
                                   ' AND a.NumeArticol like "%' + na + '%"' +
                                   ' AND c.codArticol like "%' + cc + '%"' +
                                   ' AND c.NumeArticol like "%' + nc + '%"' +
                                   ' AND NumeReteta like "%' + nr + '%"');
   frmMain.grdRetete.dbListFieldsNames:='Nume Reteta,Tip Reteta,Cant. Ref.,Activ?,Cod Articol, Nume Articol,Comisionare?,Cod Componenta, Nume Componenta, Cantitate, Fix?';
   frmMain.grdRetete.dbSQLExecute;
end;

But now, I want to add the Query to edit / modify a selected record from the tablegrid.

Thank you.

Best regards,
Alin

8

(20 replies, posted in General)

vovka3003 wrote:
const
    // режимы
    mbOkOnly = 0;
    mbOkCancel = 1;
    mbAbortRetryIgnore = 2;
    mbYesNoCancel = 3;
    mbYesNo = 4;
    mbRetryCancel = 5;
    mbCritical = 16;
    mbQuestion = 32;
    mbExclamation = 48;
    mbInformation = 64;

function MessageDialogEx(caption,msg:string; mode:integer):LongInt;
var Sh:variant;
begin
  Sh := CreateOleObject('WScript.Shell');
  result := Sh.Popup(msg, 0, caption, mode);
  Sh := 0;
end;

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var res:integer;
begin
 case MessageDialogEx('Внимание','Вопрос...',mbYesNo + mbQuestion) of
     mrYes:ShowMessage('Нажата кнопка "ДА"');
     mrNo:ShowMessage('Нажата кнопка "НЕТ"');
 end;
end;

Hi vovka3003,

I will try this and let you know.
I thought that this will be easier to get translated smile

thank you.
Alin

9

(20 replies, posted in General)

jean.brezhonek wrote:

Hello m.alin

Try this

Translate('Yes', 'Ja');
    Translate('No', 'Nein');
    Translate('None', 'None');
    Translate('Skip', 'Skip');
    Translate('Close', 'Close');
    Translate('Cancel', 'Cancel');

JB

Hi jean.brezhonek,

It doesn't get translated sad

10

(20 replies, posted in General)

Hi all,

Is it possible to translate the MessageDlg buttons into other language?
I mean, instead of Yes / No to have Ja / Nein as an example?

Thank you.

Best regards,
Alin

PS: I tried with Translate('mbYes','mbJa'); but it doesn't get translated.

11

(3 replies, posted in General)

Hi all,

Thank you very much for your responses.
Awesome workarounds:)
Thank you once again for sharing your ideas.

Best regards,
Alin

Hi all,

I would need your help to solve an issue I'm having.
I would like to show the user which button is pressed, by changing it's backcolor.

I tried another approach, like putting a panel under the button and if the 3rd button is pressed, the panel will move under the third button. All good until I've checked the scaled option on the main form, then this panel is not moving into the right position.

What would be the best solution to have this done?

Thank you.

Alin

13

(12 replies, posted in General)

CDB, Thank you for your reply.
Tried both solution, but my app is still very slow.
Should I try something else?

Thanks.

Alin

14

(12 replies, posted in General)

CDB wrote:

Are you using SQLite or MySQL?

I'm using SQLite.

15

(12 replies, posted in General)

Hello,

I've placed the application on the server and we want to work 3-4 users in the app.
As soon as the second user is connected to the application, the app is getting very slow, the data and the forms are loading very slowly.
What shall I do to make it work? In this moment the database has approx. 250 Mb and is growing.

I want to mention that, production needs only to book some data in their special form, planning to put orders in the app and print the papers in his special form.
Thank you for a solution.

Br,
Alin

Hello Derek,

I've managed to solve that issue, but now I bump into another thing.
I want to print labels.
I've created the layout and now the number of labels which need s to be printed depends on the order quantity.
For example: Order 4000 pieces, 500 pieces per box means 8 labels needs to be printed. I need also to put an increment on each label like 1/8, 2/8 ...8/8. (this I've done)

How can I achieve this the easiest way?

For the moment, I let the report in designer mode and enter the required labels in Page Counter and then print smile. I would like to block access to anyone to modify the layout of the labels.

Any help is appreciated.

Thank you.
Alin

Hello Derek,

My Project has a lot of tables already and connections between them, more than 300 Mb of data are already stored. T tried to delete data to make the Database smaller but it's impossible because of the connection between the tables.
If I make print screens would be enough?
I could also share my PC via TeamView if needed.

Thank you for you answer.

Best regards,
Alin

Hello,

I need your advice.
I have these tables:
tblArticles - all the products (raw material, finished goods) (ArticleNo, ArticleName, etc)
tblBOM - contains quantities and UM (unit of measures from tblUM and the articles from tblArticles)
tblUM - to choose the right unit of measure
tblOrders - one order contain one single articles and it's  related BOM (bill of material) from tblBOM.

On the report, on the upper part I need to have the Order and the Article (finished good) and bellow to have the related BOM with quantities and ArticleNo and ArticleNames.
Because all the information is comming from tblArticles, the upper part of the repost is correct but on the lower part only the ID's is correct. What can I do to have the right information also on the lower side of the report before printing (Article No and ArticleName)?

Appreciate any advice.

Thank you.
Best regards,
Alin

19

(1 replies, posted in SQL queries)

Hi all,

I need to make some calculations and I can't get it working.
I have 4 textboxes where  I store :
a = cycle time (type real)
b = Quantity (integer)
c = time (integer) I need to devide with 60 to get the number of minutes
d = cavities (integer)

My formula should look like this:
e = ((a * b) / c ) / d

I managed to to the calculation until here: e=(a*b) / c but when I want to divide the result to d, i'm getting an error (not a floating point).

Can someone help me achieve this or tell me the easiest way.
The value will not be stored in the database, will only be calculated on the fly when you enter  new record or edit an existing one.

Thank you.

Alin

Thank you Derek.
It's working.

Hello Dmitry,

Now when I click to edit the record, the value is correctly shown in the field.
Still, in the table grid view, the value is wrongly shown.
Should I change something in the select statement or do I have to do something in the settings of the table grid view?

Thanks.
Alin

Hello Derek,

Thanks for your answer.
i changed the type of the field from real to currency and the issue is still there.
I've checked was has been saved in the database, and there the value is stored correctly so...perhaps the issue comes from the select statement  I have.
My form contain 2 table grid views, one is with the articles and when i click on one article, the second  table grid is populated with the right Bill of material.

My Select statement looks like this:

frmArticole.grdBOM.dbSQL := 'SELECT tblBom.id,BOMName,ArticleNo, ArticleName,Quantity,UmNo,  ' +
           ' Case Active when 1 then "Da" when 0 then "Nu" End, ' +
           ' Case Fixed when 1 then "Da" when 0 then "Nu" End ' +
           ' from tblBOM ' +
           'inner join tblArticol on tblBom.id_tblArticol1=tblArticol.id ' +
           'inner join tblBomType on tblBom.id_tblBomType=tblBomType.id ' +
           'inner join tblUm on tblBom.id_tblUM=tblUm.id ' +
           'where id_tblArticol= '+ frmArticole.txtCODID.text + ;
     frmArticole.grdBOM.dbListFieldsNames:='ID,Tip BOM, Nr. Articol, Nume Articol, Cantitate,UM, Activ? ,Fix?';
      frmArticole.grdBOM.dbSQLExecute;

How can I change the Quantity in the select statement to show me the right value?
Thank you.

Br,
Alin

Hello guys,

I have a table tblBOM (Bill of material) where I need to enter an article and the consumption.
I;ve selected the field quantity as type Real, but I have values of 0.00004 pieces which in my application (table grid) are shown as 4E-5.
When i open the record to edit it, the value 4E-5 us shown...so....how could I get the entire value as 0.00004?
i tried also to replace the dot (.) with comma (,), but then my shown value is zero.

thank you.
Best regards,
Alin

Thank you ehwagner,

it's working.

Best regards,Alin.

Good morning,

I get an error message which says 'OF' expected:


frmArticoleAdd.grdBOM.dbSQL:='SELECT tblBom.id,BOMName,ArticleNo, ArticleName,Quantity,UmNo,Active, Fixed from tblBOM ' +
   'left join tblArticol on tblBom.id_tblArticol1=tblArticol.id ' +
   'left join tblBomType on tblBom.id_tblBomType=tblBomType.id ' +
   'left join tblUm on tblBom.id_tblUM=tblUm.id ' +
   'where id_tblArticol= '+ frmArticoleAdd.txtArticolID.text ;

   Case Active when 1 then 'Yes' when 0 then 'No' End
   Case Fixed when 1 then 'Yes' when 0 then 'No' End

   frmArticoleAdd.grdBOM.dbListFieldsNames:='ID,Tip BOM, Nr. Articol, Nume Articol, Cantitate,UM, Activ? ,Fix?';
   frmArticoleAdd.grdBOM.dbSQLExecute;

Thanks.