View previous topic :: View next topic |
Author |
Message |
etwoss
Joined: 22 Nov 2016 Posts: 4
|
Posted: Wed Nov 23, 2016 10:50 am Post subject: running query without persistent fields |
|
|
Hi
I have a query 'select * from <viewname>'
i have no persistent fields, just want to export the dataset to excel,
However i want to translate the displaylabels , something like:
Code: |
for i := 0 to View.fields.count -1 do
begin
View.Fields[i].DisplayLabel :=
TsiLang.Translate(View.Fields[i].DisplayLabel);
end;
|
Is there any method which i can Use?
Would be great!!
Eric
|
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Thu Nov 24, 2016 4:05 am Post subject: |
|
|
Hello,
There is no such "direct" method, but you may try to use GetStringValue() method to iterate through all existing strings and find your value and then retrieving it. |
|
Back to top |
|
 |
etwoss
Joined: 22 Nov 2016 Posts: 4
|
Posted: Thu Nov 24, 2016 7:09 am Post subject: |
|
|
isiticov wrote: | Hello,
There is no such "direct" method, but you may try to use GetStringValue() method to iterate through all existing strings and find your value and then retrieving it. |
Would it not be nice to have such method? Not to hard to develop i think.
What you mean is trying to get the fieldsdisplay value as:
siLang1.GetStringValue(@siLang1.MultiLines,
Field.DisplayLabel, siLang1.ActiveLanguage);
Eric |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Thu Nov 24, 2016 1:05 pm Post subject: |
|
|
No, I mean that if you know the values of Display_Label(s) then you can add them to Strings property with some IDs like DISPL_LBL_ID_N and translate. Changing N for every label you add. Then you can iterate through DISPL_LBL_ID_N and retrieve initial value, if it is the same as designed- then return GetStringValue(@Strings,...) with needed ID and needed language.
Hope this helps. |
|
Back to top |
|
 |
etwoss
Joined: 22 Nov 2016 Posts: 4
|
Posted: Fri Nov 25, 2016 8:39 am Post subject: |
|
|
Hi
Thanks
When loading a file from disk with first param Strings, it only read the strings part and leave all other (displayLabels)?
Eric |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Fri Nov 25, 2016 12:45 pm Post subject: |
|
|
Yes,
Code: | LoadFromFile(PropType: TStringsType; const AFileName: string; CanRewrite: Boolean) |
method loads only specified property. |
|
Back to top |
|
 |
etwoss
Joined: 22 Nov 2016 Posts: 4
|
Posted: Fri Nov 25, 2016 1:16 pm Post subject: |
|
|
Hi
Is "GetTextOrDefault" not faster than "GetStringValue"?
Eric |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Sat Nov 26, 2016 4:31 am Post subject: |
|
|
GetTextOrDefault returns only value for active language (and default if value not defined) but in your case you will need to obtain value of default language by GetStringValue and then you can use GetTextOrDefault to get active value if working only with Strings property. |
|
Back to top |
|
 |
|