Need expression for lookup function

I need a lookup function:
Tablename: Tbl_orders
Fieldname to check OrdID = 1709 then make it 7001709 else keep numbers same.
Thank you very much for the helpful info.

For a lookup function, you'll always have a compare column (Column in the lookup table) and compare expression (Expression to which the compare column is compared to).
If you nest the lookup in decode / ifthenelse, the expression will be hard to maintain like:
decode(lookup(<DataStoreName>.Tbl_Orders, OrderID, 0, 'PRE_LOAD_CACHE',Compare_Column in Tbl_Orders, Compare expression with compare column) = 1709,lpad(lookup(<DataStoreName>.Tbl_Orders, OrderID, 0, 'PRE_LOAD_CACHE',Compare_Column in Tbl_Orders, Compare expression with compare column),7,'700'),lookup(<DataStoreName>.Tbl_Orders, OrderID, 0, 'PRE_LOAD_CACHE',Compare_Column in Tbl_Orders, Compare expression with compare column))
But, I believe you do not want to make the code this complex.
Do the lookup in one Query transform (either you can add as a function in the output schema or add it in mapping tab) and get the value in one Query transform.
lookup(<DataStoreName>.Tbl_Orders, OrderID, 0, 'PRE_LOAD_CACHE',Compare_Column in Tbl_Orders, Compare expression with compare column)
In the next Query transform, do an lpad / direct hardcoding inside ifthenelse / decode.
decode(Order_ID = 1709,lpad(Order_ID,7,'700'),Order_ID)

Similar Messages

  • Need help for the Function Module 'PFL_GET_PARAMETER_INFO'

    Hi Experts,
    The FM 'PFL_GET_PARAMETER_INFO'  returns the value for Profile Parameters for a system .
    The inputs required for this FM are :
      1.   Parameter name  : ( eg . login/min_password_lng etc. )                   
      2 . Parameter Type
    I am not sure about what the value of Parameter Type should be .
    Its a mandatory field.
    I have tried to search but could not find anything.
    Can you please help me on this?
    Thanks in Advance,
    Harshit Rungta
    Edited by: harshit rungta on May 27, 2011 8:15 AM

    What exactly is the use-case for this?
    Many developers "c-call" the params and neglect this feature of the type - also whether it is static or dynamic. Some params are even dynamic as system profiles in one direction but static as instance parameters in the other direction when changing the value.
    As you cannot create your own system profile parameters, I do not see the use-case for why you are wanting to check it in advance, because the application APIs should do this.
    What you are possibly looking for is function module SUSR_GENERATE_PASSWORD in this case. It will respect "the rules" in the params.
    Do not use the legacy function RSEC_GENERATE_PASSWORD directly.
    Cheers,
    Julius

  • Need Assistance for VBA function in oracle how to implement

    My very respected and Senior, regards,
    Sir, hope you will in best of health and wealth by the grace of God,
    Sir, i have a request problem as i m very junior against you and you have passed this time before many years ago as i m standing where. Sir i m a very junior developer of oracle and have a problem putting on your desk with the hope that you can help my as a boss.
    Sir me have to calculate yield of Bond using oracle form
    i have tried my best and tired
    there is a formulae in excel which give the Yield() when we provide the parameters
    and i need the excel formulae or the oracle calculation code of PLSQL for this.
    How can i get yield when i have price, coupon rate, frequency, issue and maturity of the coupon , coupon period , next coming coupon , and others detail.
    or tell me how to use EXCEL VBA for this problem ,
    thnx n regards,
    yours student, junior developer youngest brother
    Faraz
    How can I get the solution using Excel VBA function with oracle
    so that move values to excel calculate them and copy the result from excel to oracle forms

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Need help for Conversion Function in Oracle

    Hi, Can Any One help me Please.
    I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
    Thanks In Advance.

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Need procedure for the function

    Hi
    Can any one create a procedure
    for the following
    Following is a function i need a procedure
    which basically Converts the values in the a Column to no of rows
    Example : Column Name: USA; Canada; Japan;
    in to 3 rows : USA
    Canada
    Japan
    create
    or replace function f_get_row_vals(V_column_value VARCHAR2)
    return T_LIST_OF_VALS PIPELINED
    as
    n_str_length NUMBER := 0;
    N_START_CHAR NUMBER := 1;
    N_END_CHAR NUMBER := 0;
    n_counter NUMBER := 1;
    v_value VARCHAR2(50) := NULL;
    begin
    IF V_column_value IS NULL
    THEN
    RETURN;
    END IF;
    n_str_length := LENGTH(V_column_value);
    LOOP
    N_END_CHAR := INSTR(V_column_value,';',1,n_counter);
    IF N_END_CHAR = 0
    THEN
    v_value := SUBSTR(V_column_value, N_START_CHAR, n_str_length - N_START_CHAR + 1);
    ELSE
    v_value := SUBSTR(V_column_value, N_START_CHAR, N_END_CHAR-N_START_CHAR);
    END IF;
    n_counter := n_counter + 1;
    N_START_CHAR := N_END_CHAR + 1;
    pipe row(v_value);
    EXIT WHEN N_END_CHAR = 0 ;
    END LOOP;
    RETURN;
    END;
    Thanks

    This is the procedure they are using previously.
    This procedure is calling the above function. I need like this
    CREATE
    OR REPLACE PROCEDURE P_EXPAND_USER_ACCESS_REV_MART
    IS
    rec_ODS_USER_ACCESS_REV_MART ODS.ODS_USER_ACCESS_REV_MART%ROWTYPE;
    CURSOR c_getrows
    IS
    select * from ODS.ODS_USER_ACCESS_REV_MART;
    BEGIN
    OPEN c_getrows;
    LOOP
    FETCH c_getrows INTO rec_ODS_USER_ACCESS_REV_MART;
    EXIT WHEN c_getrows%NOTFOUND;
    DBMS_OUTPUT.put_line(rec_ODS_USER_ACCESS_REV_MART.wwfo_area);
    DBMS_OUTPUT.put_line(rec_ODS_USER_ACCESS_REV_MART.soln_division);
    INSERT INTO DW_USER_ACCESS_REV_MART
    user_id,
    wwfo_area,
    soln_division
    SELECT rec_ODS_USER_ACCESS_REV_MART.user_id,
    area_tab.column_vaLue,
    soln_tab.column_value
    FROM TABLE(CAST(f_get_row_vals(rec_ODS_USER_ACCESS_REV_MART.wwfo_area)AS T_LIST_OF_VALS) ) area_tab,
    TABLE(CAST(f_get_row_vals(rec_ODS_USER_ACCESS_REV_MART.soln_division)AS T_LIST_OF_VALS)) soln_tab
    END LOOP;
    CLOSE c_getrows;
    COMMIT;
    END;

  • Re: Satellite A200 (PSAE6) - need drivers for FN functional keys

    j have toshiba a200 psae6 and j want drivers for functional keys f1 ....f12 ,and drivers for finger sensor...yesterday j reinstal my laptop,and now j have problem with this drivers...j download fingersensor from support page but doesnt work..windows 7 x 32 is on my comp...sorry for my bad english...

    Hi
    What Windows OS do you use?
    If you use Win XP then you need to install Common Modules.
    If you are using Win 7 or Vista then you have to installed VAP (value added package) firstly and then Flash Card Support Utility!

  • Need help for Count function in XSLT Mapping

    Hi All,
    We have a requirement in our project,to do the xslt mapping from OAGIS 9.0 to EDI XML.In the EDI XML we have a SE tag whose value is the count of the no. of complex elements that will be generated in the EDIXML file( which is the target).
    Please do let me know if anybody has done this functionality in the xslt mapping.
    Thanks in Advance.
    Regards,
    Kaavya

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Need code for a function module- Urgent

    Hi friends,
    I have a requirement where I am giving material description as an import parameter in the function module. ( Material description could be a wild search -- say - Mat* ) I want a sub routine in the function module which should get all the materials from the database ( mara or makt..not sure ) for the user entered Material description.
    I want this particular code to be written using a sub-routine using formal parameters inside this fm . Could any one send me the code for this.
    Thanks in advance,
    Vishnu.

    Hi Vishvanath,,
    Please find the below code.
    DATA : BEGIN OF itab OCCURS 0,
           matnr LIKE makt-MATNR,
           MAKTX LIKE makt-MAKTX,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
           matnr LIKE makt-MATNR,
           MAKTX LIKE makt-MAKTX,
           END OF itab1.
    data : a(5) type c value 'TEST'.
    perform mat_no using a.
    form mat_no  using    p_a.
    data : lv_temp(4) type c.
    select matnr maktx from makt into table itab.
    loop at itab.
    lv_temp = itab-maktx+0(4).
    if lv_temp = p_a.
      move itab to itab1.
      APPEND ITAB1.
    endif.
    endloop.
    loop at itab1.
    write :/ itab1.
    endloop.
    endform.                    " mat_no
    Thanks.
    Amjad.

  • Need Help for useOneAsmany function

    My input structure is               <Record>   1- unbounded
                   <header> 1-1
                   <Data1>  1-unbounded
                   <data2>  1-unbounded
                   <footer> 1-1
    i want to create the IDOC for data1 and data2 and using the header field while creating the IDOC.So i'm using useOneAsMany for achieving this and its working fine.
    But when i duplicate the <record> node I get the following error:
    "Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue."
    Is it possible to use useOneAsMany when the file contains more than 1 record?or is it possible for only one record. Please help me in this
    Thanks in advance
    Sreedivia

    Hi,
    Same problem i faced, are you using E1EDP01 node?
    If yes it happens only once, don't duplicate that node.
    One as Many : we have one value in the source side, but we can use that many times in the target sede in this
                   conditions we can use this node function.
                       Here it takes 3 inputs, first value represents the value to populate in the target side
                    second value represents howmany times the first value occur in the target side and the
                    third value represents where the context should change.
      watch this blog for one as many node function.   /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

  • Need help for a function

    hii all
    i am somehow unable to find a function for finding the current month
    i.e. i want to find the records for the current month
    plzz help me with the problem
    mandar

    for current month:
    SELECT to_char(sysdate, 'MON') FROM dual
    ex:
    SELECT *
    FROM table
    WHERE to_char(field_date, 'MON-YYYY') = to_char(sysdate, 'MON-YYYY')
    hope it helps

  • Need Example for AVG() function in script logics...

    Hi Everyone,
                      I need to calculate average for all the account members ...
    so if anybody worked with this AVG() in Script logics please share with me...................

    What do you mean by calculate average? Average for the period or for some other parent or..? Where do you want to store this average? How do you want to use this average???

  • Error 00936 -Missing expression for INTERSECT function

    My sql is simple one:
    I have 2 tables customer and user module. I want to get customer id and count of
    users for that customer which has both module id 9 and 13 assigned to him.
    I am using an intersect to remove duplicates.
    select c.cust_id as "Customer Id",
      select count(user_id) from
         (select um.user_id from user_mod um
             um.user_cust_id = c.cust_id
              and um.umod_id = 9
           INTERSECT
          select um.user_id from user_mod um
          um.user_cust_id = c.cust_id
          and um.umod_id = 13
        ) as "Both Modules"
    from
    customer c
    where c.not_del = 0However I am getting a ora00936 at "select count(user_id)". Anyobdy know why and how to overcome it?

    The scalar subquery in your SELECT needs to be enclosed in parens like this:
    SELECT c.cust_id as "Customer Id", 
           (SELECT COUNT(user_id)
           FROM (SELECT um.user_id
                 FROM user_mod um
                 WHERE um.user_cust_id = c.cust_id and
                       um.umod_id = 9
                 INTERSECT
                 SELECT um.user_id
                 FROM user_mod um
                 WHERE um.user_cust_id = c.cust_id and
                       um.umod_id = 13)) as "Both Modules"
    FROM customer c
    WHERE c.not_del = 0.
    However, that will still not work since Oracle will not recognize c.cust_id in the nested part of the query. I would tend to write your query as something like:
    SELECT c.cust_id as "Customer Id"
    FROM customer c,
         (SELECT user_cust_id, COUNT(*) cnt
          FROM (SELECT user_cust_id
                FROM user_mod
                WHERE umod_id = 9
                INTERSECT
                SELECT user_cust_id
                FROM user_mod
                WHERE umod_id = 13)
          GROUP BY user_cust_id) b
    WHERE c.cust_id = b.user_cust_id(+) and
          c.not_del = 0HTH
    John

  • Need advice for System_mail_send function..

    I am utilizing the System_mail_send function to send Spool reports via email. I now have 2 questions:
    1) Can System_mail_send support multiple attachments? For example, I hope it can attach the Spool file and the Log file all together in one email. Is this possible?
    2) About the Text field where can input some words in the email content. How to switch lines. I think it's too stupid to insert a bunch of 'space'. Anything like <br> in HTML can do this job?

    Right click Job Definitions on the left navigation tab and create New Job definition. When prompted, select Mail type and click Create.
    Now provide the HTML coding for your mail format inside the job definition and for dynamic values like Job definition, you can pass them from another job definition.
    You can attach the files by mentioning the filename under the [Attachments] .
    For this you must explicitly provide permissions to the directory where the files are stored in the server.
    I recommend following the admin guide, which has clear examples.
    thanks
    Nanda

  • Satellite A200 (PSAE6) - need drivers for FN functional keys

    please give me a link for this driver.j have windows 7 x32 bits on my laptop a20 psae6...a reinstal operative sistem,and again instal driver and doesn t work....my sensor is not working ...

    Hi
    You need to download the VAP (value added package) and Flash Card Support Utility.
    Both tools are needed to get the FN buttons working in Win 7!
    Ive got A210. Its a similar notebook series and Ive chosen the drivers which are released for Satellite L500 series.
    Both tools worked for my A210

  • SSRS countrow Aggregate error(Aggregate and lookup functions cannot be used in query parameter expressions.)

    Below expression works fine with text box but gives error in dataset expression.
    ="SET FMTONLY OFF select  "+ join(Parameters!Column.Value,",") +" FROM pamcustom.dbo.vw_HFL_HFD_HotfileData INNER JOIN pamcustom.dbo.HFL_HFB_HotFileBatch  on BatchID = HFB_intBatchID where BatchID ="+Parameters!BatchId.Value+"
    and "+Parameters!cmbTranType.Value+" "+ iif(CountRows("DS_Aml_Mnr_Iss_Desc")=Parameters!Mnr_Iss_Desc.count," "," and aml_mnr_iss_desc in "+"('" & join(Parameters!Mnr_Iss_Desc.Value,"','")
    & "')")+iif(CountRows("ds_ReportingCategory")=Parameters!ReportingCategory.count," "," and ReportingCategory in "+"('" & join(Parameters!ReportingCategory.Value,"','") & "')")+iif(CountRows("ds_NAICSubGroup")=Parameters!NAICSubGroup.count,"
    "," and naicsubgroup in "+"('" & join(Parameters!NAICSubGroup.Value,"','") & "')")+iif(CountRows("ds_PortTrading")=Parameters!PortTrading.count," "," and porttrading in "+"('"
    & join(Parameters!PortTrading.Value,"','") & "')")+iif(CountRows("ds_GL_LE")=Parameters!GL_LE.count," "," and gl_le in "+"('" & join(Parameters!GL_LE.Value,"','") &
    "')")+iif(CountRows("ds_coagroup")=Parameters!cmbCoaGrp.count," "," and coagroup in "+"('" & join(Parameters!cmbCoaGrp.Value,"','") & "')")+iif(CountRows("Portfolio")=Parameters!cmbPort.count,"
    "," and portfolio in "+"('" & join(Parameters!cmbPort.Value,"','") & "')")+IIf(IsNothing(Parameters!txtSecID.Value)," "," and secid in ('"+Replace(Parameters!txtSecID.Value,",","','")+"')")+iif(IsNothing(Parameters!minPortFilter.Value)
    and IsNothing(Parameters!MinPort.Value)," "," and portfolio "+Parameters!minPortFilter.Value+Parameters!MinPort.Value)+iif(IsNothing(Parameters!maxPortFilter.Value) and IsNothing(Parameters!MaxPort.Value)," ","
    and portfolio "+Parameters!maxPortFilter.Value+Parameters!MaxPort.Value)+iif(IsNothing(Parameters!minCoaFilter.Value) and IsNothing(Parameters!txtMinCoa.Value)," "," and portfolio "+Parameters!minCoaFilter.Value+Parameters!txtMinCoa.Value)+iif(IsNothing(Parameters!maxCoaFilter.Value)
    and IsNothing(Parameters!txtMaxCoa.Value)," "," and portfolio "+Parameters!maxCoaFilter.Value+Parameters!txtMaxCoa.Value)
    I guess the error " Aggregate and lookup functions cannot be used in query parameter expressions." is because I am using CountRow to ensure that if all values of multi select all selected i will not use that filter in where clause.
    Pls. guide...

    Hi, Include your parameter total count in the dataset for parameter and instead of using countrows() function use the count from dataset in the expression.
    Hope this helps.........
    Ione

Maybe you are looking for