Skip to Content
avatar image
Former Member

Need a java script to exclude this blank ID

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"))

uarwd.png (10.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 21, 2016 at 12:37 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2016 at 10:20 AM

    Rejecting blank record shows as above

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2016 at 10:37 AM

    Hi Satish,

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

    Regards,

    JP

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2016 at 11:05 AM

    OR..in conversion file try with this

    A_ *SKIP

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2016 at 01:36 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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

      JP

  • Oct 21, 2016 at 01:31 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

      rkzxs.png (4.7 kB)
  • Oct 21, 2016 at 02:19 PM

    Try conversion file with JavaScript

    In transformation use:

    DT_COSTELEMENTGROUP=ID

    In the conversion use:

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

    Add comment
    10|10000 characters needed characters exceeded