UDF question.

Hello,
I have following code in UDF that pads string to 9 characters long (fills with leading spaces) and adds to SQL query. Please look at the following code.
public void getStatement(String[] companyId,ResultList result,Container container){
int len = companyId.length;
StringBuffer ids = new StringBuffer();
   int totalLen = 9;
for (int i=0; i<len;i++)
<b>     int len2 = companyId<i>.length();
     StringBuffer paddedId = new StringBuffer(totalLen);
     int pad = totalLen-len2;
     while(pad>0)
         paddedId.append(" ");
         pad--;
     paddedId.append(companyId<i>);</b>   
     ids.append("'"paddedId.toString()"'");
     if(i != len-1)
       ids.append(",");
result.addValue("selectemp_no, emp_name from employee where emp_no in ("ids.toString()")");
I tested above function using test mapping. The following is the output.
16:57:44 Start of test
Document start
Start tag [ns1:MT_Cma_Customer_Select_Request]
Add raw attribute [ xmlns:ns1="http://freemanco.com/xi/Get_Customer"]
Start tag [Statement]
Start tag [LawsonCustomer]
Add attribute: [action]=[SQL_QUERY]
Start tag [access]
Put value [<b>select emp_no, emp_name from employee where emp_no in(' 45632')</b>
Close tag [access]
Close tag [LawsonCustomer]
Close tag [Statement]
Close tag [ns1:MT_Cma_Customer_Select_Request]
Document end
Executed successfully
16:57:44 End of test
As you see the bold code is used to pad leading spaces and after test the I do not see leading spaces in the select statement.
Can some tell me what am I doing wrong?.
Thank you for the help.
Balaji

Balaji,
I'm sorry u want Leading spaces right? My program will give u Trailing spaces. So change one line of code.
Remove sb.append(test[m]); before the 2'nd for loop and add the same in the end of seconf for loop. So now ur code b'come
StringBuffer sb= new StringBuffer();
sb.append("Select * from employee_tbl where employee_id in (");
                                int len;
          for(int m=0;m<test.length;m++)
               len= test[m].length();
               for(int k=len;k<=9;k++)
                    if(!(len==9))
                    sb.append(" ");
                          sb.append(test[m]);
               if(m==test.length-1)
                    sb.append(");");
               else
                    sb.append(",");
          result.addValue(""+sb.toString()+"");
Best regards,
raj.

Similar Messages

  • Quick java udf question

    Hi sorry for this completely stupid question but the below piece of code I am trying to dissect and understand.
    I understand the first line I am creating a new global container but the second line I am not so sure what the (integer) would be for. Is this meant to be a variable or a return type? What could that possibly be for I mean a type in parenthesis after the equals sign.
    GlobalContainer gc = container.getContainer();
    Integer counter = (Integer) gc.getParameter("counter");
    Thank you for your help.

    GlobalContainer is a container object stores values and can be retrieved by UDF during runtime. This GlobalContainer stores values and can be accessed by any UDF in the same namespace. This is similar to class variable or static variable of java class.
    In your case, It has a parameter which is set as ("counter", Integer) . Basically it is a key value pair and very similar to Hashtable in java.
    Example
    setParameter(String  str , Object  Integer);
    >What could that possibly be for I mean a type in parenthesis after the equals sign.
    typecast to integer in paranthesis, because we store the value here as Integer object.
    Integer counter = (Integer) gc.getParameter("counter");
    expecting  return type is Integer.
    Also refer this [link |global container;for further refereence

  • UDF question - how detect a non existing sender element

    Hi all,
    i have a question according UDF. I have a sender message that contains a field, that sometimes has a content ans some time not. If no content then als the element doesn't exists (occurrence 0...1). The target element of this one has the occurrence status 1.
    So i have to create a function, that writes an empty string in case of no sender element. I know that i can configure this function with the MM Blocks (if exists ...). But for re-using reasons i'd like to create a UDF for this function.
    Now my question, how can i detect if no data in the sender (src) file?
    Here my try, which doesn't works:
    AbstractTrace trace = container.getTrace();
    trace.addInfo("container: "container);+
    trace.addInfo("iData: "iData);+
    if(iData == null){
    +     trace.addInfo("NO ELEMENT found!");+
    if(container == null){
    +     trace.addInfo("NO container found!");+
    if(iData.length() < 1){
    +     trace.addInfo("Empty or No element found - insert empty entry (space)");+
    +     return " ";+
    return iData;
    Thanks in advance
    Michael

    Hi Michael,
    Create a UDF of type value,
    Suppose in is the input and out is output of UDF..
    Then Code as follows:
    if(in==null)
       out = " Empty String Found ";
    else
       out = in ;
    return out;
    Use this code...and get ur problem solved!!!
    Regards,
    AshwinM
    [Dont forget to mark the answer]

  • Mapping UDF Question.

    All,
    We have the following structure from the input XML... We want to extract the PSTLZ node value into the target structure where PARVW = "WE" - Im trying to use a UDF but - im getting an error because the PSTLZ is an optional node under E1EDKA1 and not all the E1EDKA1 segments have this field. i was trying to UDF to take 2 parameters - PARVW (context at IDOC level) and PSTLZ (context at IDOC level).
    Any help would be appreciated...
    <IDOC>
          <E1EDKA1 SEGMENT="1">
             <PARVW>AG</PARVW>
             <PARTN>1</PARTN>
             <TELFX>XXXXX1</TELFX>
             <BNAME>Mike</BNAME>
             <PAORG>100</PAORG>
             <ORGTX>US Purchasing</ORGTX>
             <PAGRU>UG1</PAGRU>
          </E1EDKA1>
          <E1EDKA1 SEGMENT="1">
             <PARVW>RE</PARVW>
             <NAME1>SomeName</NAME1>
             <STRAS>Street 1</STRAS>
             <ORT01>City1</ORT01>
             <PSTLZ> 12345</PSTLZ>
             <REGIO>NY</REGIO>
          </E1EDKA1>
          <E1EDKA1 SEGMENT="1">
             <PARVW>LF</PARVW>
             <PARTN>2</PARTN>
             <SPRAS>E</SPRAS>
             <SPRAS_ISO>EN</SPRAS_ISO>
          </E1EDKA1>
          <E1EDKA1 SEGMENT="1">
             <PARVW>WE</PARVW>
             <LIFNR>XYZ</LIFNR>
             <NAME1>NAME1</NAME1>
             <NAME4>Name4</NAME4>
             <STRAS>some street</STRAS>
             <ORT01>BUFFALO</ORT01>
             <PSTLZ>12345</PSTLZ>
             <LAND1>US</LAND1>
             <ABLAD>YYY</ABLAD>
             <PARNR>YYY</PARNR>
             <SPRAS>E</SPRAS>
             <REGIO>US</REGIO>
          </E1EDKA1>
    </IDOC>

    rkk,
    Try this
    Parvw[Change Context to IDOC] --->UDF
    PSTLZ[Don't Change Context] --->Map With Default[] -->Remove Context---> UDF
    If there are no values from PSTLZ what u want to do? According to the above logic, it will give blank value are u ok with it?
    raj.

  • Simple UDF question.

    My requirement is that I need to seperate out all the special characters in a string and take only the numbers.
    If phone number contains any brackets or hyphens, they need to be removed to form only the number.
    Since my datatype is string type.. I needed to use the string argument for my function.
    Please can anyone tell me how do I achieve this?.
    I was looking for a for loop to check the charAt every position.. but how do I seperate the chars of a string to form a new one?.
    Please advise.

    Hi
    If you need to do it only for Numbers then use this in UDF
    public String removeNonDigits(String text, Container container) {
              int length = text.length();
              StringBuffer buffer = new StringBuffer(length);
              for(int i = 0; i < length; i++) {
                   char ch = text.charAt(i);
                   if (Character.isDigit(ch)) {
                        buffer.append(ch);
              return buffer.toString();
    Thanks
    Gaurav

  • Concat UDF question

    Hi all,
    I  have a requremnt in the map.
    Source looks like this,
    Description (Node) 1-many  >   It has 2 fields in it namely :
    1.  Indicator(String) 0-1
    2. Comment(String) 1
    Now target looks like this
    ProductDescription(Node) 1-many  > it has just 1 node namely :
    1. Comments
    Requirement:
    Map description to target> productDescription as follows:
    1. If(Indicator Doesn't exist ) then map each Description.Comment to ProductDescription.Comment
    Ex: Source
    <Description><Comment>Red hammer</Comment></Description>
    <Description><Comment>Blue hammer</Comment></Description>
    then Target is
    <ProductDescription><Comments>Red hammer</Comments></ProductDescription>
    <ProductDescription><Comments>Blue hammer</Comments></ProductDescription>
    2. If(Indicator equals *) then map the Concat the prev Comment along with the current comment into 1 target "Comments"
    Ex: Source
    <Description><Comment>Red hammer</Comment></Description>
    *<Description><Indicator>(astrix ie )</Indicator><Comment>Red pencil</Comment></Description>
    then Target is
    <ProductDescription><Comments>Red hammer Red pencil</Comments></ProductDescription>
    Can anyone help me in what way i have to approach this to achive the map? In this case a UDF is inevitable is it?
    Any reply / leads is very much appreciated
    Thanks,
    Hank
    Edited by: hankovak jovani on Sep 30, 2009 4:50 AM if Indicator field is * then it indicator that the sender is sending the current comment in a NEW LINE hence have to concat it with the prev one......

    comment(context MT_Src)---->SaveComment(UDF)----->ProductDesc
           indicator--equalS----------------------------->-if---------------------->Map it to Then in the below mapping(say Label)
    sonstant[*]---/      comment--->getPreviousComment-->  then    
                  Label---> then
    indicator---->exist---->if--------------->comment
                comment---> else
    declare a global variable using Edit Java section (one of the  Functions of the Object Toolbar in Mapping Editor )under global variable
    String [ ] comment=new String[20];
    create two UDF
    SaveCommentUDF
       //write your code here
    for(int i=0;i<a.length;i++)
    comment<i>=a<i>;
    result.addValue(a<i>);
    GetPreviousCommentUDF
       //write your code here
    String pre="";
    for(int i=0;i<comment.length;i++)
    if(a.equals(comment<i>))
    pre = comment[i-1];
    return pre+a;

  • Embarrasing UDF question

    I can't believe that I haven't been able to find this answer,
    but where do UDF (.cfm) pages get stored on the hard drive?
    Thank you in advance.

    > I can't believe that I haven't been able to find this
    answer, but where do UDF (.cfm) pages get stored on the hard drive?
    Wherever you like. Stick your functions in a CFM file;
    include the CFM
    file before you need to call the function. So as long as
    you've got a CF
    mapping to the dir the file is in, the file can be anywhere
    you like.
    There's nothing magic about a CFM file full of UDFs that
    require it to be
    handled any differently than any other CFM file.
    UDFs do not even have to reside in a separate file: if you
    have the
    requirement for a specific function on one specific template,
    there's
    nothing stopping you from sticking the function code within
    the template
    itself. One would only do this if there was never any intent
    to re-use
    that function, though.
    Adam

  • Newbie question about component and UDF usage.

    This will be the 1st time I'm coding a component and UDF. I
    kind of understand the concept but not sure about how to write it
    in detail.Such as passing the parameter, etc.
    I'm starting to write a user login, verifying users before
    allowing them to enter into the app.
    So I have 2 fields in my login form, Login and password.
    Upon submitting this form, on the actionpage.cfm I'm calling
    a component. This is how I call the component:
    <CFINVOKE Component="cfc/loginaction"
    Method="AuthentiCateUser" ReturnVariable="UserInfo">
    Then in my Component I have the following:
    <CFCOMPONENT>
    <CFFUNCTION Name="AuthentiCateUser" RETURNTYPE="Query"
    hint="Use for user login">
    <CFARGUMENT Name="login" Type="Structure"
    Required="true">
    <CFARGUMENT Name="password" Type="Structure"
    Required="true">
    <!--- checking user authentication --->
    <CFQUERY NAME="Authenticate" DATASOURCE="sendfast">
    SELECT * FROM tblcustomer WHERE Login = '#Login#' AND
    Password = '#Password#'
    </CFQUERY>
    <CFRETURN AuthentiCateUser>
    </CFFUNCTION>
    </CFCOMPONENT>
    When I run this code, I got error, it said :
    The parameter LOGIN to function AuthentiCateUser is required
    but was not passed in.
    The error occurred in
    C:\CFusionMX\wwwroot\KDt_Mod\userloginaction.cfm: line 18
    16 : <CFSET
    UserLoginInfo["Password"]="#Form.Password#"> 17 : 18 :
    <CFINVOKE Component="cfc/loginaction" Method="AuthentiCateUser"
    ReturnVariable="UserInfo">
    19 :
    My question is:
    What should I do in order to pass #Form.Login# and
    #Form.Password# to my UDF within my component?
    I'm using CFMX 6 and Micrisift SQL 8

    I've applied cfinvokeargument and my login and password were
    passed to my component.
    But I'm facing new problem: Where should I write my
    authentication? should I write user authentication within my
    component or
    loginaction.cfm (the calling template)
    What I mean by authentication is something like this:
    <CFIF #Authenticate.RecordCount# IS NOT 0>
    <cfset session.CustomerID
    ="#Authenticate.customerid#">
    <cfset session.Name ="#Authenticate.Name#">
    <CFCOOKIE NAME="UserLoginIn"
    VALUE="12345_pn#Authenticate.customerid#">
    <cflocation url="index.cfm?loc=home">
    <CFELSE>
    <script language="JavaScript">
    alert("Username/password is not found, plese try again");
    history.go(-1);
    </script>
    <cfabort>
    </CFIF>
    If I keep this code in my loginaction.cfm what is returned
    from my function is not recognized by the component, the error said
    Authenticate.RecordCount is not recognized.
    Also I'm still confuse with what should I put in the
    RETURNTYPE. If I put query, it gave me error, also, what is
    returned by CFRETURN.
    This is my component:
    <CFCOMPONENT>
    <CFFUNCTION Name="AuthentiCateUser" RETURNTYPE="Query"
    hint="Use for user login">
    <CFARGUMENT Name="login" Type="Structure"
    Required="true">
    <CFARGUMENT Name="password" Type="Structure"
    Required="true">
    <!--- checking user authentication --->
    <CFQUERY NAME="Authenticate" DATASOURCE="sendfast">
    SELECT * FROM tblcustomer WHERE Login = '#Login#' AND
    Password = '#Password#'
    </CFQUERY>
    <CFRETURN AuthentiCateUser>
    </CFFUNCTION>
    </CFCOMPONENT>

  • 1st UDF and questions

    Ok, I got some code working on a page, and would like to now
    see about
    putting it in a UDF...
    The UDF right now looks like:
    <cffunction name="classSort" output="false">
    <cfargument name="eventType" type="string"
    required="yes">
    <cfset temp_var=1>
    <cfloop list="arguments.eventType" delimiters=","
    index="i">
    <cfset full_var_temp_var=#i#>
    <cfset temp_var=temp_var+1>
    </cfloop>
    <cfswitch expression="full_var_1">
    <cfcase value="f">
    <cfif var_temp_2 gte 15>
    <cfif rates.C gte 2>
    <cfif rates.B gte 2 or rates.D gte 2>
    <cfif rates.A gte 2 and rates.B gte 2>
    <img src="images/A1.gif" width="94" height="29">
    <cfelseif rates.D gte 2 and rates.E gte 2>
    <img src="images/C1.gif" width="94" height="29">
    <cfelse>
    <img src="images/B1.gif" width="94" height="29">
    </cfif>
    </cfif>
    </cfif>
    </cfif>
    </cfcase>
    </cfswitch>
    </cffunction>
    And I'd be passing arguments in the form of functin(f,30)
    What I'm trying to do is get the image filename sent back so
    I can display
    it on the page.
    Am I on the right track here???

    Well, I changed the function to:
    <cffunction name="classSort" output="false">
    <cfargument name="eventType" type="string"
    required="yes">
    <cfif eventType gte 15>
    <cfif rates.C gte 2>
    <cfif rates.B gte 2 or rates.D gte 2>
    <cfif rates.A gte 2 and rates.B gte 2>
    <cfset retImage="images/A1.gif">
    <img src="images/A1.gif" width="94" height="29">
    <cfelseif rates.D gte 2 and rates.E gte 2>
    <img src="images/C1.gif" width="94" height="29">
    <cfelse>
    <img src="images/B1.gif" width="94" height="29">
    </cfif>
    </cfif>
    </cfif>
    </cfif>
    <cfreturn retImage>
    </cffunction>
    Now my question is, in the code that's calling the function,
    the image isn't
    displaying..... I tried <img
    src="#classSort(foilCount.recordcount)#">
    Is that not correct?
    "Ian Skinner" <[email protected]> wrote in message
    news:[email protected]...
    > Steve Grosz wrote:
    >> Ok, I got some code working on a page, and would
    like to now see about
    >> putting it in a UDF...
    >>
    >> The UDF right now looks like:
    >>
    >> <cffunction name="classSort" output="false">
    >> <cfargument name="eventType" type="string"
    required="yes">
    >>
    >> <cfset temp_var=1>
    >> <cfloop list="arguments.eventType" delimiters=","
    index="i">
    >> <cfset full_var_temp_var=#i#>
    >> <cfset temp_var=temp_var+1>
    >> </cfloop>
    >>
    >> <cfswitch expression="full_var_1">
    >> <cfcase value="f">
    >> <cfif var_temp_2 gte 15>
    >> <cfif rates.C gte 2>
    >> <cfif rates.B gte 2 or rates.D gte 2>
    >> <cfif rates.A gte 2 and rates.B gte 2>
    >> <img src="images/A1.gif" width="94"
    height="29">
    >> <cfelseif rates.D gte 2 and rates.E gte 2>
    >> <img src="images/C1.gif" width="94"
    height="29">
    >> <cfelse>
    >> <img src="images/B1.gif" width="94"
    height="29">
    >> </cfif>
    >> </cfif>
    >> </cfif>
    >> </cfif>
    >> </cfcase>
    >> </cfswitch>
    >>
    >> </cffunction>
    >>
    >> And I'd be passing arguments in the form of
    functin(f,30)
    >>
    >> What I'm trying to do is get the image filename sent
    back so I can
    >> display it on the page.
    >>
    >> Am I on the right track here???
    >
    > Wow that is some obtuse logic there. I'm going to go
    with that you know
    > why you are doing all that looping at the beginning.
    >
    > The first thing I'm seeing is an incompatibility with
    output="false" and
    > <cfif...>...<img ...> logic.
    >
    > This code is attempting to output <img...> tags
    but that is disallowed in
    > the <cffunction...> tag. You either need to allow
    output - which would
    > also include all the white space in the function if
    steps are not taken to
    > control it. Or save the <img....> tag code into a
    string variable and
    > then return that variable at the end of the function
    with a <cfreturn ...>
    > tag.
    >
    >

  • Question for support of community for an UDF

    Hello,
    because we are not really able to write Java-Code we have a question for support to the community!
    We have a mapping were we get some strings. These strings containing data which we have to map to certain fields in target structure.
    Example:
    001GIE;002090429;0030853;005D  ;007TCT ;010TTNU9457423 ;01140;01296;013SCI01;019
    4N ;02145G1;027E;0300;033V;03508388;03604508;03703880;039003054 ;040003054
    The requirement is that we have to identify the fields to map by it's number, like "001GIE" means 001 field in target structure.
    So how to do an UDF? We need to parse the string and put the found strings into right position in an array e.g. But how to get this result to the single target-fields in target structure?!
    And another problem in example: how to get data if the identifier (019) and the data (4N) is divided by an end of line (see example)?!
    Do you have some ideas?! We highly appreciate your help!
    br

    Hi Fritz,
    Let us address the problem one by one.
    1. You might need to change the source structure to :
    -root 1..1
    --Value 1..unbounded
    Please note root and Value are the names given by me you can use any names as per your wish. But we cannot have the source as you specified, will this source be ok for you?
    2. Give File content conversion parameter
    recordset name = Vale
    Value.endSeparator 'nl'
    By doing this there will be a Value node created when the source file has a newline character
    3. In message mapping create two UDF
    *UDF1 (Simple ?UDF with input field named *input )
    for (int i=0;i<input.length;i++)
       output += input<i>;
    return output
    *UDF2 (Simple UDF with input field named input)*
    int i = 1;
    String [] value = new String[112];
    while (input.indexOf(";") != -1)
    String counter = "";
    Integer i_int = new Integer (i);
    if (i<10)
        counter = "00"+ i_int.toString();
    else if (i>9 && i<100)
         counter = "0"+ i_int.toString();
    else counter = i_int.toString();
    if (input.startsWith(counter)) {
      value<i> = input.substring(3, input.indexOf(";"));
      if (input.indexOf(";") != -1 )
         input = input.substring(input.indexOf(";")+1);   
    else
      value <i> = "";
    i++;
    int j;
    GlobalContainer globalContainer = container.getGlobalContainer();
    globalContainer.setParameter("Output", value);
    Now do a mapping like this
    Value (context root)--> UDF1 > UDF2> target root node (ie Bewsatz)
    By this step you set all the values in global container named Output
    3. Now for each target  field call this UDF
    *UDF3 (Simple UDF with input field named pos)*
    GlobalContainer globalContainer = container.getGlobalContainer();
    String[] Value = (String[] )globalContainer.getParameter("Output");;
    String outvalue;
    if (Value != null) {
    outvalue = Value(pos) ;
    return outvalue;
    Call this UDF for each output field with positions like 1, 2, 3, ...111
    Please try this
    Regards
    Suraj

  • Formatted search with UDF and syntax question

    Can you explain the syntax with when to use the dollar sign and negative in writing a query for a formatted search based on user entry?
    I now want to create a formatted search to pull values based on the user's entry into a UDF on the item master screen.
    User entry into UDF U_Customer Code
    to create Formatted search for UDF U_Rep01
    I tried the following, but it does not work.
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $http://$OITM.U_CUSTOMERCODE
    Thanks.
    Please advise.

    The right syntax would be like this:
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $[OITM.U_CUSTOMERCODE\]
    However, the logic of query may not be correct.  Select something must be already in the system and Where should also be locatable.
    Thanks,
    Gordon

  • UDF or FMS Query Question

    Hi,
    I have a UDF in Item Master which I call it Part Number.
    I don't want to do an auto FMS for this UDF in marketing document row when I select an item. However, I want to type in the Part Number (just like how we are able to type in the item code) in my marketing documents row and the details of the item master such as item code and item description will appear. Is this doable?

    Hi Joyce......
    BP Catalog is a thing where you can map it but it should have to define BP master also. But if you use Barcode Field into the Item Master Data as Part No. then the moment you select item master it will display its barcode Field as its standard field of SAP and there is no need to have FMS.
    But you will have the fix part no. for particular Item........
    You can work it out.
    Regards,
    Rahul
    Edited by: RAHUL MOUNDEKAR on Dec 14, 2010 4:05 PM

  • Reading Numeric UDF null value in DI

    We have a UDF of Numeric(4) that can be NULL, 0, 1, 2, etc. We try to read it from DI, and if it is NULL, then set the result to be -1 (the default value we difined), so we can differentiate NULL and 0.
    The C# code we have look like this:
    int LineNumber = -1;
    SAPbobsCOM.Company oCompany;
    // Code to get Company
    SAPbobsCOM.Documents oDoc = oCompany.GetBusinessObject(BoObjectTypes.oQuotations);
    oDoc.GetByKey(100); // Get the document by DocEntry
    LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
    The problem is LineNumber gets 0 even if in the database U_XX_LN is NULL. We tried the code below and got the same result because oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString() always return '0' if it is NULL.
    if (string.IsNullOrEmpty(oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString()))
        LineNumber = -1;
    else
        LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
    The question is: how can we set it to default -1 if in the database the value is NULL?
    Thank you,
    Grace

    Hi Grace,
    Unfortunately the DI API automatically converts database null values to a default value for the datatype (eg null for numeric becomes 0 and null for strings is an empty string). If you want to differentiate between null and zero you will need to query the table using the isnull command rather than reading the table through the UserTables object:
    oRecordSet.DoQuery("select isnull(U_XX_LN, -1) as U_XX_LN from [@MYTABLE] where Code = 'MYCODE')
    This will convert the null value to a -1 in the recordset so you can tell the difference between nulls and zeros.
    Kind Regards,
    Owen

  • Adding a new UDF throws a null pointer exception and modifying user.xml

    Hello,
    I have a two part question.
    i. I am trying to add a UDF (using Advanced>User Configuration..Attributes) to a fully configured OIM i.e. oim with reconciliation and provisioning from and to resources but it throws a null pointer exception. Look at the log, I see
    ===============Excerpt form the log file==========
    [2012-01-26T11:28:14.447-05:00] [oim_server1] [NOTIFICATION] [] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [[
    ---Stack Trace Begins[[This is not an exception. For debugging purposes]]---
    oracle.iam.platform.authz.impl.OESAuthzServiceImpl.doCheckAccess(OESAuthzServiceImpl.java:210)
    oracle.iam.platform.authz.impl.OESAuthzServiceImpl.hasAccess(OESAuthzServiceImpl.java:188)
    oracle.iam.platform.authz.impl.OESAuthzServiceImpl.hasAccess(OESAuthzServiceImpl.java:180)
    oracle.iam.platform.authz.impl.AuthorizationServiceImpl.hasAccess(AuthorizationServiceImpl.java:173)
    oracle.iam.configservice.impl.ConfigManagerImpl.checkAuthorization(ConfigManagerImpl.java:1899)
    oracle.iam.configservice.impl.ConfigManagerImpl.addAttribute(ConfigManagerImpl.java:177)
    oracle.iam.configservice.api.ConfigManagerEJB.addAttributex(Unknown Source)
    ... 21 lines skipped..
    oracle.iam.configservice.api.ConfigManager_5u0nrx_ConfigManagerRemoteImpl.addAttributex(ConfigManager_5u0nrx_ConfigManagerRemoteImpl.java:864)
    ... 13 lines skipped..
    oracle.iam.configservice.api.ConfigManagerDelegate.addAttribute(Unknown Source)
    oracle.iam.configservice.agentry.config.CreateAttributeActor.perform(CreateAttributeActor.java:266)
    oracle.iam.consoles.faces.mvc.canonic.Model.perform(Model.java:547)
    oracle.iam.consoles.faces.mvc.admin.Model.perform(Model.java:324)
    oracle.iam.consoles.faces.mvc.canonic.Controller.doPerform(Controller.java:255)
    oracle.iam.consoles.faces.mvc.canonic.Controller.doSelectAction(Controller.java:178)
    oracle.iam.consoles.faces.event.NavigationListener.processAction(NavigationListener.java:97)
    ... 24 lines skipped..
    oracle.iam.platform.auth.web.PwdMgmtNavigationFilter.doFilter(PwdMgmtNavigationFilter.java:115)
    ... weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    oracle.iam.platform.auth.web.OIMAuthContextFilter.doFilter(OIMAuthContextFilter.java:100)
    ... 15 lines skipped..
    weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    ---Stack Tracefor this call Ends---
    [2012-01-26T11:28:14.447-05:00] [oim_server1] [NOTIFICATION] [IAM-1010010] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: 1] [arg: null] [arg: USER_MANAGEMENT_CONFIG] [arg: CREATE_ATTRIBUTE] ********** Entering the Authorization Segment with parameters:: LoggedInUserId = 1, target resourceID = null, Feature = USER_MANAGEMENT_CONFIG, Action = CREATE_ATTRIBUTE **********
    [2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010021] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: [InternalObligation: name: noop, values: [true], convertToObligation: false, InternalObligation: name: noop, values: [true], convertToObligation: false]] Validating the Internal Obligations: [InternalObligation: name: noop, values: [true], convertToObligation: false, InternalObligation: name: noop, values: [true], convertToObligation: false]
    [2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010022] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] ---------- The list of Internal Obligation is satisfied, returning TRUE ----------
    [2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010026] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: Decision :PERMIT\nObligations from policy: ] ********** Exiting the Authorization Segment with result Decision :PERMIT[[
    =============Excerpt ends==============
    Is there a reason why this is and how do I get by it.
    ii. Can I just add the field directly within the MDS>file/user.xml? Would there be an issue with changing an existing attribute metadata using the user.xml?

    Pradeep thank you for your response. it was helpful. However, I also found the responses to both my questions.
    i. The null pointer exception was due to using a complex query I was using in the LOV query. I tried a simple query and that worked fine.
    ii. For modifying the user defined attributes one can consult the following forum post:
    OIM 11g - Change UDF Field Type form String to LOV
    Thanks

  • Question regarding the If-then-else function

    Hi folks ,
    I have been constantly putting threads on this subject for the past day,  hope it doesn't annoy any one here.
    My scenario is really simple, and i am  almost close to the solution, but there is just 1 thing missing and i know that is a very small thing, could be the context too. Hope some one can help by pointing it out>
    Mapping:
    In my source i have a header(0-unbounded) & detail(0-unbounded). At a given instant either header / detail will occur in source, depending on that the target node "response" will occur(0-n times)
    i have achieved this in the mapping.
    the problem is this:
    Both the Header/Detail have a field in it called Sequence# which is mandatory and can occur only once in the Header/Detail node.
    Now depending on what occurs: ie Header/Detail i need to map that particular seq# into my Target Respone's SEQ_#.
    I have done the mapping for this and have done a standalone testing.
    Mapping: Check if HEADER EXISTS, if yes? then map the HEADER.Seq# to TARGET.Seq#
    Here are my findings:
    Scenario1: 3 header nodes(No Detaili) each with a seq # in it. Out put 3 Target node each with 3 seq # in it.
    Scenario2: 2 Detail Nodes(No header) each with a seq # in it. Output fails to produce the 2nd Target Structure's Seq# and Fails
    When i look into the Display Queue in the mapping , i examine the iF-Then-Else function:
    Since HEADER doesn't exist i c 1 Suppress in my If-Condition hence the if condition becomes FALSE., now since its false its supposed to map the seq# from my detail. (This case i have 2 ).
    But in the output of the IF-Then Else, i get out only 1 seq # which is the 1st one,
    What i am thinking is that the exists condition is giving out only 1 FALSE instead of 2, If there were 2 false from the exists then i would have had both the seq # in my output,
    I hope my question is clear, Would appreciate anysort of help . And i apologize if I seem to be brigning up the same question over again experts.
    I don't wnt to create a UDF for this matter because i know there is something i am not doing right,
    Hank

    Sorry I could not give my udf in my last post.
    Udf1:
    Create a context udf and name it as RemoveSuppress. Take two input arguments a and b. Imports: java.*;
    Add this code:
       //write your code here
    boolean found = false;
    for (int i=0;i<a.length;i++) {
         if (a<i>.equals(b[0])) {
         found = true;
         break;
    if (found == true)
         result.addValue("true");
    else
         result.addValue("false");
    Then it should work.
    Regards,
    ---Satish

Maybe you are looking for