Page 1 of 1

running query without persistent fields

Posted: Wed Nov 23, 2016 10:50 am
by etwoss
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: Select all

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


Posted: Thu Nov 24, 2016 4:05 am
by isiticov
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.

Posted: Thu Nov 24, 2016 7:09 am
by etwoss
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

Posted: Thu Nov 24, 2016 1:05 pm
by isiticov
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.

Posted: Fri Nov 25, 2016 8:39 am
by etwoss
Hi

Thanks

When loading a file from disk with first param Strings, it only read the strings part and leave all other (displayLabels)?

Eric

Posted: Fri Nov 25, 2016 12:45 pm
by isiticov
Yes,

Code: Select all

LoadFromFile(PropType: TStringsType; const AFileName: string; CanRewrite: Boolean)
method loads only specified property.

Posted: Fri Nov 25, 2016 1:16 pm
by etwoss
Hi

Is "GetTextOrDefault" not faster than "GetStringValue"?

Eric

Posted: Sat Nov 26, 2016 4:31 am
by isiticov
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.