Changing the text returned by a query.

Question:

How can I change the type of text being displayed in an E3Browser or Report (for example, to have it display True or False instead of 0 or 1)?

Solution:

In this case, an alternative is to edit the SQL query, forcing it to return the desired values according to the values used as condition.

Examples:

In an SQL Server database, use SELECT CASE or IIF:

SELECT E3TimeStamp, CASE WHEN Field1 = 0 THEN ‘False’ ELSE True END as ColumnName
FROM Table1
ORDER BY E3TimeStamp ASC
SELECT E3TimeStamp, IIF(Field1 = 0, ‘False’, ‘True’) as ColumnName
FROM Table1
ORDER BY E3TimeStamp ASC

In an Access database, use IIF command:

SELECT IIF(Field1 = 0,’True’,’False’) as ColumnName, E3TimeStamp
FROM Table1
ORDER BY E3TimeStamp ASC

In an Oracle database, use SELECT CASE:

SELECT
CASE
When Severity = ‘0’ Then ‘False’
When Severity = ‘1’ Then ‘True’
END
FROM Table1

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *