Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
poluvidyasagar
Creator II
Creator II

Map SubString using ApplyMap

Hi,

I am trying to map a value from an inline table but I want to get only left substring of the mapping value.

Example:   

PartVal|Country
A3|India
B4|USA
C5|Russia
D6|Germany

I want to map Part A using apply map function to only Val field value (3).

Similarly, for B I want to get 4 and so on.

Can someone let me know how to achieve this?

Thanks,

4 Replies
sunny_talwar

May be this

SubField(ApplyMap('MappingTableName', Part, Null()), '|', 1) as ....

aunahsan
Partner - Contributor III
Partner - Contributor III

you can use the left function. it would be Left(Val|Country, 1)

this should return most character in the field, which is what you're looking for

here is the syntax: Left(text, count )

sasiparupudi1
Master III
Master III

may be change your mapping load

Map_table:

Mapping Load

Part

SubField([Val|Country],'|',1) as Val

From your table;

alis2063
Creator III
Creator III

Hey Please find the below scripts,

Data:
Mapping Load Part,SubField(Val|Country,'|',1) AS Country Inline [
Part,Val|Country
A,3|India
B,4|USA
C,5|Russia
D,6|Germany
E,67|UK];
FactData:
Load ApplyMap('Data',Part) as 'Mapping Country',* Inline [
Part,Ratio
A,33
B,44
C,55
D,65
E,68];

 

 

OP

 

MAP OP.png