I am trying to create alias for a field in the table and unable to do it with any function. Below is the code i used.
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
{business_id},
‘d0ec5ca55b56’, ‘8’
),
‘47bcfa6b09ae’, ‘7’
),
‘71d692c93727’, ‘6’
),
‘62cb1e6fefa0’, ‘5’
),
‘984c6d8d33dd’, ‘4’
),
‘84cf785f951c’, ‘3’
),
‘2a9555747d7e’, ‘2’
),
‘dac021257986’, ‘1’
),
‘e020034d1dc0’, ‘0’
)
)
)
)
)
)
I even tried using ifelse and below is the code used
IFELSE(
{business_id} = ‘d0ec5ca55b56’,
‘8’,
IFELSE(
{business_id} = ‘47bcfa6b09ae’,
‘7’,
IFELSE(
{business_id} = ‘71d692c93727’,
‘6’,
IFELSE(
{business_id} = ‘62cb1e6fefa0’,
‘5’,
IFELSE(
{business_id} = ‘984c6d8d33dd’,
‘4’,
IFELSE(
{business_id} = ‘84cf785f951c’,
‘3’,
IFELSE(
{business_id} = ‘2a9555747d7e’,
‘2’,
IFELSE(
{business_id} = ‘dac021257986’,
‘1’,
IFELSE(
{business_id} = ‘e020034d1dc0’,
‘0’,
{business_id} – Keep the original business_id if no match is found
)
)
)
)
)
)
)
)
)
Hi @kchalla.05,
You had the right idea with the ifelse function but the syntax was wrong.
Can you try this instead?
ifelse(
{business_id} = 'd0ec5ca55b56', '8',
{business_id} = '47bcfa6b09ae', '7',
{business_id} = '71d692c93727', '6',
{business_id} = '62cb1e6fefa0', '5',
{business_id} = '984c6d8d33dd', '4',
{business_id} = '84cf785f951c', '3',
{business_id} = '2a9555747d7e', '2',
{business_id} = 'dac021257986', '1',
{business_id} = 'e020034d1dc0', '0',
{business_id}
)