Jump to content

uniDBGrid Rotated


itognet
 Share

Recommended Posts

I am evaluating the uniGUI, and it seems that it can be customized alot, which I need.

 

Well, I think this is abit hardcore question, but maybe somebody knows a solution.

 

I have a data set with only 1 record

 

Fieldnames: f1, f2, f3

Data: x1, x2, x3

 

Shown in a uniDBgrid:

f1 f2 f3

x1 x2 x3

 

How can I customize a uniDBGrid to rotate, so it looks like this:

 

f1 x1

f2 x2

f3 x3

 

thanks :)

Link to comment
Share on other sites

Hello itognet,

If you are using :
1. Microsoft SQL Server, use :   PIVOT
2. ORACLE, use                     :  CROSSTABS
3. FireBird, use                       :   LEFT JOIN
 
 
​Here is a FireBird Select SQL  example :
 

With T(IDExamination, DateExamination, Examen, Valeur)
as
(
 Select IDExamination, DateExamination, Examen, Valeur From TEXAMINATIONS
)
 

SELECT
   TE.EXAMEN,
   LIST(V1.Valeur, '   -   ') AS "2016/11/01",
   LIST(V2.Valeur, '   -   ') AS "2016/11/02",
   LIST(V3.Valeur, '   -   ') AS "2016/11/03"
FROM
   TEXAMINATIONS TE
LEFT JOIN
   T V1
      ON V1.IDExamination = TE.IDExamination AND
         V1.DateExamination = '2016/11/01'
LEFT JOIN
   T V2
      ON V2.IDExamination = TE.IDExamination AND
         V2.DateExamination = '2016/11/02'
LEFT JOIN
   T V3
      ON V3.IDExamination = TE.IDExamination AND
         V3.DateExamination = '2016/11/03'
/*
WHERE
   V1.Valeur IS NOT NULL OR
   V2.Valeur IS NOT NULL OR
   V3.Valeur IS NOT NULL  */
 
Group By TE.EXAMEN
order by TE.EXAMEN ASC

 

 

 

Regards.

post-1785-0-94353200-1478895109_thumb.png

post-1785-0-35991300-1478895716_thumb.png

Link to comment
Share on other sites

Thank you for clarifying that I have to look in other directions.

I will check out the rotate SQL example, very interresting.

 

I solved it by using a UniStringGrid with this code:

 

USG.RowCount := FDMeta.FieldCount;
 
for i := 0 to FDMeta.FieldCount-1 do
begin
  USG.Cells[0,I] := FDMeta.Fields.FieldName;
  USG.Cells[1,I] := FDMeta.Fields.AsString;
end;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...