itognet Posted November 10, 2016 Share Posted November 10, 2016 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 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 10, 2016 Administrators Share Posted November 10, 2016 Hi, I think what you need is a PivotGrid. We will add a PivotGrid component in future. Quote Link to comment Share on other sites More sharing options...
radiocab Posted November 10, 2016 Share Posted November 10, 2016 Now try to use..\FMSoft\Framework\uniGUI\Demos\Desktop\Property Gridor just rotate your table on database side Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted November 11, 2016 Share Posted November 11, 2016 Hello itognet, If you are using :1. Microsoft SQL Server, use : PIVOT2. ORACLE, use : CROSSTABS3. 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 TELEFT 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.EXAMENorder by TE.EXAMEN ASC Regards. Quote Link to comment Share on other sites More sharing options...
itognet Posted November 12, 2016 Author Share Posted November 12, 2016 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.