In Apex select list i have columns concatenate with 2 values like ,
My query is
SELECT DISTINCT (COUNTRY_DESC || ' ' || COUNTRY_ID) d , COUNTRY_ID r FROM FROM ADDRESS ;
Output is :
India IN
United kingdom UK
United states US
But her i want output as below, the output should align with space as shown below , how to achieve this
Expected Output:
India IN
United kingdom UK
United states US
How to achieve this?
Unfortunately, simple options others already suggested (keeping data in a CHAR
datatype column or RPAD
) don't work in Apex.
Here's one option which actually works.
Sample table:
create table test (id varchar2(2),
country_desc varchar2(80)
);
insert into test values ('India', 'IN');
insert into test values ('United Kingdom', 'UK');
In Apex, create a select list item (e.g. P4_COUNTRY
) whose LoV query does use RPAD
function, but with Unicode non-breaking space characters:
select rpad(country_desc, 30, unistr('\00a0\00a0\00a0')) || id as d,
id as r
from test
Additionally, set Inline CSS page property to
#P4_COUNTRY{
font-family: monospace;
}
Without it, description and ID would contain designed number of spaces in between, but output would still look ugly.
Run the page; result is as follows: