Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Apply Map

Hi Friends,

I'm using apply map function for my requirement. Apply map has been applied perfectly.

I'm taking  field from  table 1 through apply map.

I need to do  calculation of this fields at  table 2.

SUM(TRIM(ApplyMap('Pol_DISC_MAP',TP_BI_ID,Null()))POL_DISC_LC_1)/COUNT(DISTINCT TR_RISK_SR_NO) as RISK_DISC_LC_1,

Is this possible to do  like above in another way because the above logic is throwing  error.

Please anyone suggest me.

Regards

Krishna

7 Replies
rajeshvaswani77
Specialist III
Specialist III

Hi Krishna,

Can you post an small example of what you are trying to do?

What you are doing will not work because POL_DISC_LC_A is directly after the brackets which is wrong syntax, also you want to take sum of something that is a string.

thanks,

Rajesh Vaswani

Ralf-Narfeldt
Employee
Employee

Are you missing an operator before POL_DISC_LC_1?

manojkulkarni
Partner - Specialist II
Partner - Specialist II

What exactly your Map table is going to return ? If going to return some numbers then there should be mathematical operations before POL_DISC_LC_1

SUM(TRIM(ApplyMap('Pol_DISC_MAP',TP_BI_ID,Null()))POL_DISC_LC_1)/COUNT(DISTINCT TR_RISK_SR_NO) as RISK_DISC_LC_1,

krishna20
Specialist II
Specialist II
Author

Hi All

Please find the sample file.

My apply map field need to return the amount field  from table 1 and it will be taken as sum in the Table 2.

Here the total sum should be divided by the count(TR_RISK_SR_NO).

Anonymous
Not applicable

I will suggest you,

first do only applymap

ApplyMap('Pol_DISC_MAP',TP_BI_ID,Null()))POL_DISC_LC_1) as colname

then in preceding load or in resident load do other calculation.

do you use any group by function in load for aggregation ?

Thanks

BKC

krishna20
Specialist II
Specialist II
Author

Hi Bala,

Yes i tried before as you told.In this situation, my table fields will repeat thrice because of using group By function.

In preceding load we need to load all fields and need to repeat at Group By.

As usual Table Load 1 time.

Anonymous
Not applicable

if you want to load aggregated table then definitely you need to include all the fields in group by.

for preceding load you can have

load *,

sum(col name)

or you can do resident load and drop the original table.

Thanks

BKC