1 (edited by v_pozidis 2015-12-16 13:25:13)

Topic: When I choose something from a TableGrid how is it possible I show the

When I choose something from a TableGrid how is it possible I show the choosen record in a TextBox. ?

exmple
the table has thee records (LastName, Name, Age)

2 (edited by Роман 2015-12-15 18:01:06)

Re: When I choose something from a TableGrid how is it possible I show the

Доброго настроения!
посмотрите это...

Post's attachments

Attachment icon Report.zip 1.34 mb, 833 downloads since 2015-12-15 

Re: When I choose something from a TableGrid how is it possible I show the

Sorry I forgot to write that I need a script.

Re: When I choose something from a TableGrid how is it possible I show the

Hello v_pozidis

You have also this form of script



procedure Form1_TableGrid1_OnCellClick (Sender: string; ACol, ARow: Integer);
Var   s : String;
begin
     Form1.Panel3.Visible := True;

     s := SQLExecute('SELECT Nom from CDThek WHERE id=' + IntToStr(Form1.TableGrid1.dbItemID));
       Form1.Label5.Caption := s;

      ---- and son on if other captions -----
end;

I use it frequently, it is very efficient

JB

Re: When I choose something from a TableGrid how is it possible I show the

Thank you works fine.

and when I have a record which is a Relationship ?
example
The Table A has The Details of the employee but the name came from a different table witch  a Relationship to the employee table

Re: When I choose something from a TableGrid how is it possible I show the

v_pozidis
Can you show me the exact structure of your tables?

Dmitry.

7 (edited by v_pozidis 2015-12-16 14:29:04)

Re: When I choose something from a TableGrid how is it possible I show the

I have a form with a tableGrid and  some EditBoxes. I like whn I select something from the tablegrid to show the selected record in the edit box. I send you my example

Post's attachments

Attachment icon Dokimi.zip 355.33 kb, 535 downloads since 2015-12-16 

Re: When I choose something from a TableGrid how is it possible I show the

Hello v_pozidis

Fisrt thing see on frmShow : yoyr 3 editboxes have fields TableName and FieldName empty.
Second thing : for a better efficiency, you should use a script.

You can slim code by deleting which is not used to your program

See my proposition, in attachment

To read you

JB

Post's attachments

Attachment icon Dokimi2.zip 6.27 kb, 496 downloads since 2015-12-16 

Re: When I choose something from a TableGrid how is it possible I show the

Yes it is what I was asking
Thank you so much.
And because I am not familiar with SQL can you please explain me what the script <  left outer join  > means ?

Re: When I choose something from a TableGrid how is it possible I show the

Hello v-pozidis

Glad I could help you with your project

In SQL, the LEFT JOIN (SQL keyword) command (also called LEFT OUTER JOIN) is a type of join between two tables. This will list all the results of the left table (Table1 ) even if there is no match in the second table (Table2).

Imagine an application that contains users and commands for each user. The database of this application contains a table (left table = table 1) for users and save their purchases in a second table (Table 2). The two tables are linked through the user_id column of the orders table. This allows to associate a command to a user. Here the commun element between the 2 tables is id column.

Of course I'm simplifying a bit.

Best school to understand SQL language (and his power) is to search on the Net with keyword SQL

http://www.w3schools.com/sql/sql_join_left.asp
http://www.sqlcourse.com/intro.html
http://www.tutorialspoint.com/sql/sql-overview.htm

Do not hesitate to also study the SQL code snippets appearing in the FAQ MVD under Script

You have all the chances to find your happiness
If I can help you more

JB

Re: When I choose something from a TableGrid how is it possible I show the

Thank for your quick response and of course foe your help