How to use a String Dictionary
-
- Posts: 10
- Joined: Mon Sep 04, 2017 7:44 am
How to use a String Dictionary
I have a huge Dictionary<string,string> with thousands of entries, that I would like to use in a report. How do I use a given entry in the Dictionary as a label in the designer?
I tried several things, e.g.
var myDict = new Dictionary<string,string>();
myDict.Add ("test", "Le Teste");
myReport.RegBusinessObject ("Language", myDict);
myReport.Dictionary.SynchronizeBusinessObjects (1);
and then in the Report I add the text {Language["test"]}, but this is redered empty.
TIA Martin
I tried several things, e.g.
var myDict = new Dictionary<string,string>();
myDict.Add ("test", "Le Teste");
myReport.RegBusinessObject ("Language", myDict);
myReport.Dictionary.SynchronizeBusinessObjects (1);
and then in the Report I add the text {Language["test"]}, but this is redered empty.
TIA Martin
Re: How to use a String Dictionary
Hello,
Sorry for the delay with response.
You can use the following expression:
Thank you.
Sorry for the delay with response.
You can use the following expression:
Code: Select all
{FirstIf(Language.Value,Language.Key == "test")}
-
- Posts: 10
- Joined: Mon Sep 04, 2017 7:44 am
Re: How to use a String Dictionary
Thanks for the reply. It seems your solution only works if the dictionary only contains one entry. If I have
var myDict = new Dictionary<string,string>();
myDict.Add ("test", "Le Teste");
myDict.Add ("some other test", "une autre teste");
myReport.RegBusinessObject ("Language", myDict);
myReport.Dictionary.SynchronizeBusinessObjects (1);
in the code and
{FirstIf(Language.Value,Language.Key == "test")}
in the report, this text is rendered empty. Same with {FirstIf(Language.Value,Language.Key == "some other test")}
Any advice?
TIA
MArtin
var myDict = new Dictionary<string,string>();
myDict.Add ("test", "Le Teste");
myDict.Add ("some other test", "une autre teste");
myReport.RegBusinessObject ("Language", myDict);
myReport.Dictionary.SynchronizeBusinessObjects (1);
in the code and
{FirstIf(Language.Value,Language.Key == "test")}
in the report, this text is rendered empty. Same with {FirstIf(Language.Value,Language.Key == "some other test")}
Any advice?
TIA
MArtin
Re: How to use a String Dictionary
Hello,
We couldn't reproduce this bug.
Please clarify which product and version are you use?
Thank you.
We couldn't reproduce this bug.
Please clarify which product and version are you use?
Thank you.
-
- Posts: 10
- Joined: Mon Sep 04, 2017 7:44 am
Re: How to use a String Dictionary
I'm using Version 2017.1.3 from 11 May 2017, ASP.NET, JS
Please see this project: https://drive.google.com/file/d/0B9TGY2 ... sp=sharing
In Dictionary.aspx, Dictionary.mrt is loaded and a Dictionary>string,string> is created with 3 entries.
The report has 3 text lines with the expression {FirstIf(Language.Value,Language.Key == <WHATEVER_KEY>)}
only the first one is rendered.
TIA, Martin
Please see this project: https://drive.google.com/file/d/0B9TGY2 ... sp=sharing
In Dictionary.aspx, Dictionary.mrt is loaded and a Dictionary>string,string> is created with 3 entries.
The report has 3 text lines with the expression {FirstIf(Language.Value,Language.Key == <WHATEVER_KEY>)}
only the first one is rendered.
TIA, Martin
Re: How to use a String Dictionary
Hello,
Unfortunately, in the JS version business objects are not supported. Sorry.
Thank you.
Unfortunately, in the JS version business objects are not supported. Sorry.
Thank you.
-
- Posts: 10
- Joined: Mon Sep 04, 2017 7:44 am
Re: How to use a String Dictionary
I'm not using JS, I'm using ASP.NET, as you can see in the project posted above.
Re: How to use a String Dictionary
Hello,
This is a feature of business objects working. You should place for each Text component additional DataBand with linking to the business object. In this case, most easy is to use variables instead dictionary object.
Thank you.
This is a feature of business objects working. You should place for each Text component additional DataBand with linking to the business object. In this case, most easy is to use variables instead dictionary object.
Thank you.