Home > Forum > Plugins > How to Display SDK Plugin Field in a Report Table as a Multi-Choice Field with Multilanguage Support

How to Display SDK Plugin Field in a Report Table as a Multi-Choice Field with Multilanguage Support
0

I have created a simple SDK Plugin that includes one input field.

In the database, the field's value is saved in the format "24#24 Months$$de-DE$$24 Monate", and it is displayed in the report exactly as "24#24 Months$$de-DE$$24 Monate".

My goal is to display this value in the report as "24 Months" when the user's language is English, and as "24 Monate" when the user's language is German. How can I achieve this multilanguage display in the report?

Hi,
I don't have a ready solution for you but maybe this will help a little.

First of all the language code should have two characters e.g. de, en (according to the documentation:
https://community.webcon.com/posts/post/multilingual-choice-fields/264/23 )

Additionally there is an SQL function that can return the name in a given language
e.g. SELECT dbo.ClearWFElemAdvLanguage('24#24 Months$$de$$24 Monate','de') returns "24 Monate"

You could do a calculated column in the report but you would have to get the language code of the current user.... I don't know if such a code exists :/

In reply to: Daniel Krüger (Cosmo Consult)

Hi Ahmed,

how does it solve your problem?
- Did you find a variable for the language code?
- Do you have different reports/views for different languages?
- Is the report not available and linked somewhere and you are passing the language as a URL parameter?

Best regards,
Daniel

Hi Daniel,

I used calculated column on the report where I applied the built in function that Jacek mentioned SELECT dbo.ClearWFElemAdvLanguage('24#24 Months$$de$$24 Monate','de').

I created a business rule that returns Current User Language and on a calculated column I replaced 'de' part with Business rule code({BRD:id}).
'24#24 Months$$de$$24 Monate' part was replaced with a code that represents Databse field name of a SDK Field object({WFCONCOL: id}).

The final formula of a calculated column looks like this: (SELECT dbo.ClearWFElemAdvLanguage({WFCONCOL:id},'{BRD:id} ') )

It is done on a single report and I am not passing any url parameters.

In reply to: Daniel Krüger (Cosmo Consult)

Hi Ahmed,

it's interesting to know that business rules are executed/replaced in a calculated column. This is probably an unsupported feature, at least I have never read anything about it. :)

Did you already test, whether the id is replaced when you transport the application to another environment?
If it is not replaced, you could still use your solution by using the id from the production environment for the variable. It only has to work in the production environment. :)

Best regards,
Daniel

Hi,

I have not tested different environments yet. It's not necessary to use business rule code for the language, we could also use directly Current User Language code which is {USERLAN}.
(SELECT dbo.ClearWFElemAdvLanguage({WFCONCOL:id},'{USERLAN} ') ) works well.

I have a question regarding SDK C# logic.
Suppose I have two form fields, Field X and Field Y, and an SDK plugin is attached to Field X.

When the C# method ConvertToDBTypeAsync is called, it saves data for Field X into the database.
I would like to save the same data into Field Y as well.
Are there any built-in functions that can help with this?