c# - User!Language vs CurrentThread -


for formatting our dates in rdl-files, use following format:

=first(formatdatetime(fields!somedate.value, 2)) 

according page, should take computer's regional settings.

the problem is: if call reporting-service via service , try set language:

rs.setexecutionparameters(mapparameters(report.parameters).toarray(), "de-ch");  

this gets ignored. tried override thread-cultures via

system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo("de-ch"); system.threading.thread.currentthread.currentculture = new system.globalization.cultureinfo("de-ch"); 

which gets ignored well. whats string: reporting-server has de-ch culture well, keeps using english date-format.

can tells me what's meant "computer's regional settings" , why reporting-service refuses take passed culture?

edit: language in report is

=user!language 

generally said i'd pass report-language outside, via currentthread or via parameter. both ignored.

short answer

instead of formatdatetime, use format , specify expected output format:

=first(format(fields!somedate.value, "dd.mm.yyyy")) 

or alternative have culture in parameter, in case have read long answer.

long answer

your first attempt setexecutionparameters set culture of parameters, not affect report (only parameters pass it).

your second attempt change culture of client application, not affect report (only client application culture).

the formatdatetime function uses computer regional settings, not in reporting services. take report culture, in case user!language.

user!language returns language configured in client web browser when browsing report server.
i'm not sure behavior when calling web services (a specific setting taken or default en-us).

the report language property can expression, nothing stops adding text parameter report, say, reportculture, , use in properties => language:

=parameters!reportculture.value 

you have keep using expression dates:

=first(formatdatetime(fields!somedate.value, 2)) 

you can configure default value (de-ch in case), setting specified if want override it.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -