Joined: 01 Nov 2011
Online Status: Offline
Posts: 3
Topic: How to change text string Posted: 01 Nov 2011 at 12:22am
Hello, I am using Crystal Reports 2008. I have a Q how to replace/change a text string. I have in database following string (this is just an example, text are of course different) - "de=Guten tag|pl=Dzień dobry|en=Good day|ru=добрый день|es=buen día|cs=Dobrý den". This is few words in few languages and I need to prepare report for each language and for this language get just text in this language, for example in German report will get back "Guten Tag" in English report "Good day", etc. Could you please advise wich function and how to use? Thanks in advance.
Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Posted: 01 Nov 2011 at 1:18am
If {Table.Field} = ("whatever is in the field") then "Guten Tag" else {Table.Field}
Not sure if that's exactly right but it should be close.Someone better at formulas than me will probably be along shortly to either fix it or submit a better solution.
Joined: 01 Nov 2011
Online Status: Offline
Posts: 3
Posted: 01 Nov 2011 at 1:36am
Thanks but this is not exactly what I am looking for. I have in this field all languages just marked with de=german, en=english, etc. I would like replace a part of this string for example replace "de=*cs=" with "" and in this case will get back only cs language text....
Joined: 22 May 2009
Online Status: Offline
Posts: 347
Posted: 01 Nov 2011 at 2:55am
Try something like:
whileprintingrecords; local stringvar nlanguage:="en=" //This string variable would need to define the language of the report. I'm assuming you may have a parameter for this. If so, replace "en=" with "{?parameter}&"=")//
local stringvar ntext:=mid({table.textstring},instr({table.textstring},nlanguage)+3);
Joined: 22 May 2009
Online Status: Offline
Posts: 347
Posted: 02 Nov 2011 at 2:00am
Is the field set as an array? That's the only thing I can think of why it wouldn't work. Glad to hear you got something that does work for you though. Cheers!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum