Question:
In an application developed in two different languages (English and Portuguese, for example), the alarm messages are saved in both languages. How can I sort these messages out, and then display only the messages in the selected language in an E3Browser?
Solution:
For E3 version 4.0 (or higher), you can adopt a solution similar to the one presented in KB 50264, using VBScript’s Split function in E3Browser’s OnFormatCell event. For E3 version 3.5 (or previous), you must use a function inside the database to return the separated text. For example, at SQL Server:
CREATE FUNCTION [dbo].[XLate](@text Varchar(500), @lang Int) RETURNS Varchar(500) AS BEGIN DECLARE @ret Varchar(500) DECLARE @idx Int SET @idx = CHARINDEX(' /// ', '-' + @text) IF @idx > 0 BEGIN IF @lang = 0 SET @ret = SUBSTRING(@text, 0, @idx - 1) ELSE SET @ret = SUBSTRING(@text, @idx + 4, LEN(@text) - @idx - 3) END ELSE BEGIN IF @lang = 0 Set @ret = @text ELSE SET @ret = '' END RETURN @ret END
In E3Browser’s query, you can use the function with SELECT. For example:
SELECT InTime, OutTime, dbo.XLate(Message, < %Idioma% >) as Message FROM Alarms
Related article: