SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

running query without persistent fields

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
etwoss



Joined: 22 Nov 2016
Posts: 4

PostPosted: Wed Nov 23, 2016 10:50 am    Post subject: running query without persistent fields Reply with quote

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


Code:
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Nov 24, 2016 4:05 am    Post subject: Reply with quote

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
View user's profile Send private message
etwoss



Joined: 22 Nov 2016
Posts: 4

PostPosted: Thu Nov 24, 2016 7:09 am    Post subject: Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Nov 24, 2016 1:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
etwoss



Joined: 22 Nov 2016
Posts: 4

PostPosted: Fri Nov 25, 2016 8:39 am    Post subject: Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Fri Nov 25, 2016 12:45 pm    Post subject: Reply with quote

Yes,
Code:
LoadFromFile(PropType: TStringsType; const AFileName: string; CanRewrite: Boolean)

method loads only specified property.
Back to top
View user's profile Send private message
etwoss



Joined: 22 Nov 2016
Posts: 4

PostPosted: Fri Nov 25, 2016 1:16 pm    Post subject: Reply with quote

Hi

Is "GetTextOrDefault" not faster than "GetStringValue"?

Eric
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sat Nov 26, 2016 4:31 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group