cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need a java script to exclude this blank ID

Former Member
0 Likes
1,673

Please let me know any one knows the javascript to exclude this blank ID

*MAPPING
ID=*STR(A_)+ID
ACCTYPE=*NEWCOL(EXP)
BW_A_ID=*STR(ID)
CO_AREA=*STR(9020)
DT_COSTELEMENTGROUP=*IF(ID(1:4)=*STR(9020) then ID; *STR())
DT_COSTELEMENT=*IF(ID(1:4)=*STR(9020) then *STR(); ID)

*CONVERSION
ID=F_ACCOUNT_MSTR_CONV.xls!CONVERSION
DT_COSTELEMENTGROUP=F_ACCOUNT_MSTR_CONV.xls!DT_ACCTGRP
DT_COSTELEMENT=F_ACCOUNT_MSTR_CONV.xls!DT_COSTELEMENT

Conversion file at present :

CONVERSION:
*IF(%external%=A_9020* then js:%external%.replace(/^(A_9020)?(.+)$/, "A_$2"))
DT_ACCGRP:
*IF(%external%=9020* then js:%external%.replace(/^(9020)?(.+)$/, "$2"))

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi All ,

I have updated transformation files *mapping section (Last two lines).

It skips the blank ID, no warnings at all and I have double checked the master data in BPC and it is working fine now.

Could you please explain this code for me?

Thanks,

Satish

*MAPPING (New)


ID=*STR(A_)+ID
ACCTYPE=*NEWCOL(EXP)
BW_A_ID=*STR(ID)
CO_AREA=*STR(9020)

DT_COSTELEMENTGROUP=*IF(ID=*STR( ) then *STR( ); ID(1:4)=*STR(9020) then ID; *STR( ))
DT_COSTELEMENT=*IF(ID=*STR( ) then *STR( ); ID(1:4)=*STR(9020) then *STR(); ID)

Old *MAPPING (Old)


ID=*STR(A_)+ID
ACCTYPE=*NEWCOL(EXP)
BW_A_ID=*STR(ID)
CO_AREA=*STR(9020)
DT_COSTELEMENTGROUP=*IF(ID(1:4)=*STR(9020) then ID; *STR())
DT_COSTELEMENT=*IF(ID(1:4)=*STR(9020) then *STR(); ID)

Answers (6)

Answers (6)

former_member186338
Active Contributor
0 Likes

Try conversion file with JavaScript

In transformation use:

DT_COSTELEMENTGROUP=ID

In the conversion use:

* js:/^9020/.test(%external%.toString()) ? %external% : ''

former_member186338
Active Contributor
0 Likes

But not sure that conversion file can generate empty values...

former_member186338
Active Contributor
former_member186338
Active Contributor
0 Likes

Explanation:

In the original line:

DT_COSTELEMENT=*IF(ID(1:4)=*STR(9020) then *STR(); ID)

You are trying to get first 4 characters from ID and with empty ID it will generate error!

With

DT_COSTELEMENTGROUP=*IF(ID=*STR( ) then *STR( ); ID(1:4)=*STR(9020) then ID; *STR( ))

you first check for empty and only after - get first characters.

By the way it will still generate error if you get the ID with 1,2 or 3 characters

Former Member
0 Likes

Thanks for your time Vadim,

Luckily we have all the master data with 4 characters 🙂
As per your suggest I have created 3 character master data (ID=123) in BW and loaded then getting below warning message,
It should be an issue on going so is there any permanent solution for this?

Regards,
Satish

Former Member
0 Likes

Hi JP,

I have tried A_ *SKIP and also created a dummy member

ID=*IF(ID=*STR() THEN *STR(A_TEST);*STR(A_) + ID) then tried A_TEST *SKIP but still getting warning.

Many thanks,
Satish

Former Member
0 Likes

Can you show the warning please? What is it that you are trying to achieve in javascript? logic?

JP

Former Member
0 Likes

OR..in conversion file try with this

A_ *SKIP

Former Member
0 Likes

Hi Satish,

But why do you want to use java script for ignoring blank??? why not through transformation?

Regards,

JP

Former Member
0 Likes

Rejecting blank record shows as above