Forum Stats

  • 3,827,561 Users
  • 2,260,792 Discussions
  • 7,897,297 Comments

Discussions

How to pass variable value to IKM Option

992217
992217 Member Posts: 17
edited Apr 24, 2013 3:24PM in Data Integrator
Hi All,


I' ve created one new option in IKM with text datatype and used in One of the interface .Assigned one variable to this Option.
Modified the IKM to do set of operations based on the value of v_sql_string.

CHK_VARIABLE:#V_SQL_STRING

When I ran the interface the value of the variable is not assigned to this option properly.
Please let us know how can we assign the value of the variable to IKM option .

Thanks
Tagged:

Answers

  • DecaXD
    DecaXD Member Posts: 742
    try #PROJ_CODE.VARIABLE
  • 992217
    992217 Member Posts: 17
    Already tried as below but the value is not assigned to the variable.

    Thanks
  • mRainey
    mRainey Member Posts: 386 Bronze Badge
    Is the issue that the variable doesn't have a value? If so, you can either assign a default value to the variable or create a Package, add the Variable with type Refresh, and then add the Interface. If not, what sort of error are you receiving?

    Regards,
    Michael Rainey
  • DecaXD
    DecaXD Member Posts: 742
    Have you put a declaration and assigment / refershing step ? Is latest value type?
  • 992217
    992217 Member Posts: 17
    I've passed default value true to the variable(#sql_str) and created a package and added the variable of refresh type and interface .But the value of the variable didnt assign at ikm option(chk_variable) .Didnt get any error message but instead of going to first condition ,it always falls under the else condition .

    <%if (odiRef.getOption("CHK_VARIABLE").equals("true"))
    { %>
    truncate table <%=odiRef.getTable("L","TARG_NAME","A")%>
    <%}
    else { %>
    <%}%>

    Thanks
  • 992217
    992217 Member Posts: 17
    Kept the variable as Refresh type .It holds the latest value.

    Thanks
  • DecaXD
    DecaXD Member Posts: 742
    Hi,

    first of all else hasn't got any sense. I'd re-write as following

    <%if ("TRUE".equals( odiRef.getOption("CHK_VARIABLE")))
    { %>
    truncate table <%=odiRef.getTable("L","TARG_NAME","A")%>
    <%}%>
    Personally i prefer to assign numeric values. They have less issue. I have a doubt about what you are doing. Are you sure that you want that a variable could truncate your table?
    You may define this step as optional by expand "Option" (below your code), deselecting "Execute Always" and selecting CHK_VARIABLE.
  • 992217
    992217 Member Posts: 17
    Hi,

    For testing purpose i've written else condition to print "hi" (code is not embedded in else part ). Everytime it prints "hi". Based on the value of the variable , need to decide whether to truncate the table or not .Implemented in above manner only to invoke this step.If I passing the value of the variable directly to the IKM option then table gets truncated but instead
    of that passing of variable (package) it always falls under else condition .

    Thanks
  • DecaXD
    DecaXD Member Posts: 742
    hi,

    i've tried several option but i'm not able to solve it. Under my opinion it'd be better to use a workaround. I haven't got a dev test but, i strongly think that THIS COULD WORK with little modifications.

    Source step (Oracle techno)
    SELECT <%=odiRef.getOption("CHK_VARIABLE")%> PIPPO FROM DUAL
    Target Step
    TRUNCATE TABLE :PIPPO
    Let me know (remember to put an ignore errors)
  • Anuk,

    Based on your code odiRef.getOption("CHK_VARIABLE").equals(true) it seems that CHK_VARIABLE will hold a boolean value. But you are saying that CHK_VARIABLE holds a string that should be some kind of SQL. What is correct?

    What is the business objective behind putting varible as option values? Variables are user inputs, so are the KM options. It may be possible that there are better way of achieving the same.
This discussion has been closed.