running query without persistent fields

This forum designated to discuss the TsiLang Components Suite.
Post Reply
etwoss
Posts: 4
Joined: Tue Nov 22, 2016 2:57 pm

running query without persistent fields

Post 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 &#58;= 0 to View.fields.count -1 do
begin
  View.Fields&#91;i&#93;.DisplayLabel &#58;=   
                  TsiLang.Translate&#40;View.Fields&#91;i&#93;.DisplayLabel&#41;;
end;
Is there any method which i can Use?
Would be great!!

Eric


isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post 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.

etwoss
Posts: 4
Joined: Tue Nov 22, 2016 2:57 pm

Post 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

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post 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.

etwoss
Posts: 4
Joined: Tue Nov 22, 2016 2:57 pm

Post 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

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Yes,

Code: Select all

LoadFromFile&#40;PropType&#58; TStringsType; const AFileName&#58; string; CanRewrite&#58; Boolean&#41;
method loads only specified property.

etwoss
Posts: 4
Joined: Tue Nov 22, 2016 2:57 pm

Post by etwoss »

Hi

Is "GetTextOrDefault" not faster than "GetStringValue"?

Eric

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post 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.

Post Reply