Decode formula for Interactive Compute field

Hi,
Need help for decode formula for Interactive Compute field.
What is wrong with the formula below?
What I want is...
If BH field value is 'Y' then get T field value else 'OK'
If T field value does not begin with 'FY11 OU%' then get AL field value else 'OK'
If AL field value ends with 'REC' then 'CHECK' else 'OK'
DECODE(SUBSTR(decode(SUBSTR(decode(BH,'Y',T,'OK'),1,7),not like 'FY11 OU%',AL,'OK'),-3),'REC','CHECK','OK')
I get error message: Invalid computation expression. not
Would you please suggest me a correct formula?
FYI, I'm using Apex 3.0 which does not support CASE WHEN THEN END.
Thanks,
Guy

DECODE(BH || SUBSTR(T,1,7) || SUBSTR(AL,-3),'YFY11 OUREC','OK','CHECK')
I guess the above code will mark 'YFY11 PRREC' as 'CHECK' because it is different from 'YFY11 OUREC'.
But according to my second case criteria, it should be marked as 'OK' because...
BH = 'Y'
T does not begin with 'FY11 OU'
AL ends with 'REC'.
Currently I'm running filtering with your formula. But it is taking too long time. I guess there are too many lines matching with this criteria.
Thanks,
Guy

Similar Messages

  • In VB Programming code -- How to access the formula for suppressing a field

    In VB Programming code -- How to access the formula for suppressing a field
    I am using Crystal Reports 2008 v1
    Using VB code, I am attempting to modify a Crystal Report before exporting it into a PDF format and then displaying it on the Web.
    My problem is that I am unable to access the formula used to dynamically suppress a field.
    The following code is working:
    mySections = rd.ReportDefinition.Sections
    For Each mySection As CrystalDecisions.CrystalReports.Engine.Section In mySections
       ' myFieldToChange is a String set to the text of the field I need to adjust the Suppression
       iloop = 0
       For Each RecObj As CrystalDecisions.CrystalReports.Engine.ReportObject In mySection.ReportObjects
               If mySection.ReportObjects.Item(iloop).Name.ToLower = myFieldToChange Then
                   myTextObject = CType(mySection.ReportObjects.Item(iloop), CrystalDecisions.CrystalReports.Engine.TextObject)
                   myTextObject.Text = "new field text goes here"
                   mySection.SectionFormat.EnableSuppress = True
                   '  Here is where I want to change the formula for the Suppression
                End if
                iloop = iloop + 1
        Next
    Next
    I can not find any reference to the actual suppression formula in the SDK help file.
    Note, the EnableSuppress can be set to True for False, but if there is a formula for dynamic suppression, the True or False value is overwritten.  The results of the formula determine the suppression.
    Is there a way to reference this formula.  I know that I can put on in using the Crystal Report Designer software, I need to modify this formula using VB code and the SDK.

    Hello, Mark;
    If you are using the ReportDocument object you do not have access to the Conditional Suppression formula. You can get around it by using a formula field in the report for the supression and then using the FormulaField code to change it at runtime.
    If you want to change the supression condition directly at runtime you need to use RAS and the ReportClientDocument.
    Elaine

  • Two formulas for a single field in Transfer Rules ?

    Hi friends ,
    I am learning BW  3.5 . I have got a problem could you please solve it ...
    My flatfile:           Empno     Empfirstname       Emplastname
                               1000         rajiv                     gandhi
    Expected Result: Empno     Empfirstname       Emplastname
                               1000         RAJIV                RAJIVGANDHI
    I need to concatenate and Convert it into capital letters for the same field (Emplastname)
    Points will be rewarded
    Thanking You

    Hi,
    then just create a routine in the transfer rules.
    routine for first name.
    result = tran_structure-empfirstname.
    translate result to upper case.
    routine for last name.
    concatenate tran_structure-empfirstname tran_structure-emplastname into result.
    translate result to upper case.
    kind regards
    Siggi

  • Interactive Report Compute Field Creation Computation Formula

    I'm trying to create a compute field in Interactive Report in APEX 3.
    There are two fields: 'Plan Type' and 'Product Type'.
    I want to create Compute Field - 'My Check'
    Condition is as follows:
    If 'Plan Type' field value begins with 'FY11 AA' and 'Product Type' field value ends with 'ABC' then 'My Check' field value should be 'CHECK' else 'OK'.
    'Plan Type'-----------'Product Type'----------'My Check'
    FY11 AA123---------123ABC-------------------CHECK
    FY11 BB123---------123KKK--------------------OK
    FY11 CC123---------123ZZZ--------------------OK
    Would appreciate if you can write for me a computation formula for the case above.
    Thanks,
    Guy

    Hi Jari,
    Thanks for your formula.
    When I tried that, I got error as below.
    Actual formula entered:
    case when BH = 'Y' then
    case when SUBSTR(T,1,7) = 'FY11 OU' then
    case when SUBSTR(AL,-3) = 'REC' then
    'CHECK'
    else 'OK' end
    else 'OK' end
    else 'OK' end
    Error message:
    Invalid computation expression. then case

  • Add line break in name of an interactive report computed field

    I have a computed field in an IRR and need the name of this field to be broken into 2 lines. In regular columns I can add "br" right in the column attributes but if I use that in the computed field name, the HTML "br" actually shows up in the field name. How can I do this?

    Here is a threa dealing with a nowrap issue for an IRR, try making the nowrap setting in the css a wrap and see what happens..
    Re: Interactive Report - fields wrapping
    Thank you,
    Tony Miller
    Webster, TX

  • Error while Creating a formula for field AZNOR (T-Code : OP17)

    Dear Experts,
    i am facing a problem in Transaction OP17 while creating a formula for field AZNOR ( No of indivual capacity in work center) in work center (T-Code : CR02) .
    It shows the error
    The data object "F" has no component called "AZNOR''..
    Please let me know the solution..
    Thanks & Regards
    Birendra Kumar

    Hi,
    I have the same problem.
    Could You tell me witch is the correct origin?
    Thanks a lot!
    Bye
    Laura

  • Compute formula for forecasting

    Hello,
    I want to compute the formula for reorder point in the system which includes min inventory + safety stock + daily consumption while doing forecasting for a material.
    The automatic reorder point type MRP is set for the material masters & forecasting is done for the same.
    But when the reorder point is computed through system , it does not match with the manually computed reorder point.
    Can anyone tell me any method to incorporate this manual formula into the system?
    Regards,
    Krutika

    Use this user exits, to deviate from Standard Formula.
    M61X0001  User exits PP-MRP materials planning
    M61X0002  User Exits PP-MRP Material Requirements Planning Evaluations
    You may also be required to to look into funtion modules of planning evaluations report. Check out this menu in IMG.
    SPRO > MM > Consumption-Based Planning > Evaluation > Reports, Function Modules: Program Customer-Specific Lists
    Thanks & regards
    Hameed Parvez

  • How to create compute field

    Hi,
    Does anybody know how to create a compute field based on other input fields and data retrieved from the database in the same page ?
    I use an interactive form and report which has 2 input fields, 1 drop-down list containing identifiants and a kind of total field which has to be calculated from the 2 first input fields, 1 value retrieved from the database by the identifiant seleted that i may put in a hidden field. On form submit (click on the create button), the value calculated in this compute field has to be inserted into database as any other input field.
    I've tried many things : button , process, computations after regions and so on but nothing works. I wonder if i can put some pl/sql or expression in the default value of the compute field ?
    As i'm new in apex, can somebody tell me how do these objects work together ? how to refer to a field in the form with an 'apex expression' ?
    Thks a lot

    Hi,
    I've tried 2 solutions. The first one, with calculations performed by trigger, works well but i can't see the total before inserting into DB.
    The second is what i prefer but impossible to get it work.
    So if someone has an idea, please help
    in my pdetail_modele page_
    I have
    - 2 input fields P28_X and P28_Y
    - 1 compute field P28_CTP
    - a button "compute CTP" which has to display, for example, the sum of P28_X and P28_Y in the P28_CTP field.
    Here is what i did
    - process (before regions) create_mod_collection:
    begin
    if apex_collection.collection_exists(p_collection_name=>'MODELE') = false then
    apex_collection.create_collection(p_collection_name=>'MODELE');
    else
    for x in (select n001, n002 from apex_collections where collection_name='MODELE')
    loop
    :P28_X := x.n001;
    :P28_Y := x.n002;
    end loop;
    end if;
    end;
    - P28_X and P28_Y : nothing in source field
    - P28_CTP source value or expression : select nvl(:P28_X,0) + nvl(:P28_Y,0) from dual;
    - Button Compute_CTP action : redirect to page in this application with p_detail_modele in page field.
    - process (after regions) add_modele_collection :
    apex_collection.add_member(p_collection_name=> 'MODELE', p_n001=>:P28_X, p_n002=>:P28_Y);
    Thks
    Edited by: user469717 on Apr 23, 2013 11:33 AM

  • Example of a formula in a text field

    Is it possible to input an example of a formula in a text field?
    For example:
              (To get abc - EFG)
    HIJ=           KLM
    thanks

    Okay,
    If you want static instructions to support a textfield, you could use a text object. You can type in the formula at design time. The advantage is that the user cannot interact/change this the formula.
    Another option is to use the caption of the textfield object to show the formula.
    You can also set up a null pattern in the textfield object, so that the formula appears if the user has not put in a value into the field.
    Lastly, you can also use the textfield object to contain the formula, by going to the Object > Value palette and inputting the formula as the default value.
    If you have a problem with any of these come back,
    Niall
    Assure Dynamics

  • Formula for calculating Quarter value in current calendar Year

    Hi All,
    I have a requirement where in i need to display values for Q1 of Current Calendar Year, Q1 of Previous Calendar Year,Variance in Value and % Variance in Value...Similarly for Q2,Q3,Q4.
    We have built the report directly from Bex Query from the SAP tab in Crystal Reports. The formula for Quarter1,Variances etc are defined in Bex Structures and i am unable to get 'em individually here rather i am getting them as a whole in a single object with the structure name. Now is there a way that i can define my own formula in Crystal Reports so that i can get the values for the constraints defined above???
    If yes please give me the syntax or an example formula so that i can work around.
    please Help,
    Thanks & regards,
    R.N

    What fields are you getting?
    or what is the data you are working with is it
    transID, date, value......
    or is it
    Q1, Year1, Value.......

  • PLEASE HELP: PDF Forms, creating average formula for text?

    Hello,
    I really hope somone can help. I cannot find any answers to my questions on the internet, google etc.
    First time using Acrobat. Im pretty quick learning on compters however the formulas my boss has asked me to do I have no idea if they are possible.
    We have a report form for exams and each section I need to calculate the average mark for that section.
    There are 3 questions for the first section. There are dropdowns for distinction, Merit, Pass and Below pass to select for each questions.
    Please see picture attached to show you what I mean.
    I want to be able to calculate the most selected/average dropdowns selected and not count the N/A's into award1 field?
    The fields must be text and cannot be numbers.
    so for example, track 1 got a distinction, track 2 got a Merit, Track 3 got a distiction. all other fields left n/a
    is there anyway to do this also is there any way to exactly the same as above as check boxes? - please see picture attached
    I appriciate any help. I am working on a mac
    Thanks
    Lauren

    Thank you so much reply
    Yes on the dropdowns the distincion, merit, pass or below pass values are in the correct areas ready for selection. For example on the distiction row you can only drop down for distinction and so on for Merit row dropdowns etc
    Check box is the way I rather do it as its quicker, however I created the dropdown option just incase check boxes average was not possible
    On the check boxes if i select merit for rtack 1 I would just tick the box and leave the the rest of the colum blank with no ticks. So just by seeing the tick I know its in the merit section for Track 1. However I donts know if I can do an average formula for with check boxes.
    If I check boxed/slected distinction for track 1, distnction for track 2 and merit for track 3 (obvisley any box could be ticked depeneding how the exam went so need then all in the script). I would like it to then calculate the avergae mark which would be distinction in the award1 field. While the none ticked boxes or N/A fields not affecting the average.
    This is just the start to a huge form Im doing Im dreading the rest of formulas I have to do lol
    sorry if im confusing you

  • How to restrict number of characters for an input field

    Hi All,
    I have an input field.
    The max number of characters for this input field is 10.
    when a user enter more then 10 characters. it should prompt for an error or the input field should not allow to accpet the 11 character.
    how we do this in VC.
    need your helpful answers
    Rgds
    Srinivas

    Hi Srinu
    You could achieve this by configuring error messages under the formula:-
    Select the control properties and in the Input field at the Display tab write the formula
    "IF((@<LEN(text)>10),'appropriate message','Records available')"
    Note :- there is a LEN(text) under text functions in formula tab.
    Regards
    Navneet
    Message was edited by:
            Navneet Giria

  • How to add a computed field to a reports

    I have a report where I would like to add a column that is the sequence of the row. It is not the rownum in the db, but I want it to be a row number for what is returned.
    So, if I return 10 records, I would like a column to contain 1 through 10 to depict the row number.
    I do not want to have this number in the table or view.
    Is it possible to add a computed field to a report like this?
    If so, how?
    Thanks - Jim

    The SQL function rownum should suffice if the report is not too complicated, as this returns the number of the row rather than the database row ie.
    select empno,ename,rownum
    from emp
    add some clauses each time and you should see that each row is always numbered 1 to n.
    However, if you introduce the HTMLDB column sort functionality into the report then it would appear that it is the result set that is sorted rather than a new query being issued.
    Hope this is of help.

  • How to write a formula for display the value by group

    Post Author: abadugu
    CA Forum: Formula
    Hi
    Could any one please help me on writing the formula for the below senario.
    I'm creating Crystal report Via using ClearQuest (IBM tool) since this tool is not supporting subreport function. I'm planning to write a formula.
    I have grouped report by request_type field (request_type field contains Validation Defect, Production Defect, Known Defect  etc..)
    right now my report output is grouped by request_type
    ex:
    Validation Defect
                         SUMMARY                                                          COMMENTS
    Production Defect
                       SUMMARY                                                          COMMENTS
    my question was
    If request_type = Production Defect  display  pm_number value field otherwise display null
    ex
    Production Defect
    PM#          SUMMARY                                                       COMMENTS
    Validation Defect
                     SUMMARY                                                       COMMENTS
    could you please help me writing a formula.
    Thanks
    Anand

    Post Author: abadugu
    CA Forum: Formula
    It worked Thank you and I appreciated your help
    Thanks

  • Error in Fast Formula for Supplemental Earnings Elements

    Hi,
    I have an requirement in Supplement Earning Elements for US Localization. I need to define some Supplement Earning Elements that should comes in Payroll with the extension of existing Elements.
    Here are the Steps for setups which i have done so far-
    Step 1:Created new Elements with their values with effective dates for existing user Table name
    Step 2:Done the setup for New Elements with classification as Supplemental and Category also attached the formula like "FLAT AMOUNT" formula for Calculation rule in Element Earning screen.
    Step 3: when i tried to query for the element i have created, the value in Calculation Field is "Elementname_FLAT_AMOUNT_RWSI" which is not same for the existing elements.Existing Element which is of same classification and same category the Calculation rule field is "ElementName_FLAT_AMOUNT".
    Step 4: After that i did setup for Element Description and Element Link.
    Step 5: Then i have copied the Formula from Existing element(which is previously configured and working fine for the existing elements ), made the modifications for the newly created element. When Compiling the formula ,i am getting an Error "Incorrect Data type"
    I have two queries -
    1- The setup in Earnings Screen with Calculation Rule is correct or not. As the Calculation Field for newly elements and the existing elements are different (as mentioned in Step 3).
    2- Compilation Error "Incorrect Data Types" in Fast Formula.(as mentioned in Step 5).
    I m pasting the Fast Formula code here for ready reference
    Default for TERMINATED_EMPLOYEE      is 'N'
    Default for RUN_TYPE               is 'R'
    Default for FINAL_PAY_PROCESSED      is 'N'
    default for PAYROLL_TERMINATION_TYPE is 'L'
    default for BG_TERMINATION_TYPE is 'L'
    default FOR LAST_STANDARD_PROCESS_DATE_PROCESSED IS 'N'
    DEFAULT FOR ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD     IS 0
    DEFAULT FOR ELEMENT_NAME_ADDITIONAL_ASG_GRE_ITD     IS 0
    DEFAULT FOR ELEMENT_NAME_REPLACEMENT_ASG_GRE_ITD     IS 0
    DEFAULT FOR ELEMENT_NAME_ASG_GRE_YTD IS 0
    DEFAULT FOR ELEMENT_NAME_ASG_GRE_RUN IS 0
    Default for PAY_EARNED_START_DATE is '02-JAN-0001' (DATE)
    Default for PAY_EARNED_END_DATE is '02-JAN-0001' (DATE)
    Default for ASG_NUMBER is ' '
    Default for ELEMENT_NAME_ASG_GRE_FYTD IS '0'
    Default for CURRENT_ELEMENT_TYPE_ID is 0
    Default for GROUP_KF_PAY_FREQUENCY is '0'
    DEFAULT FOR Amount IS 0
    INPUTS ARE Amount
    IF ELEMENT_NAME_REPLACEMENT_ASG_GRE_ITD WAS DEFAULTED OR ELEMENT_NAME_REPLACEMENT_ASG_GRE_ITD = 0 THEN
    pay_frequency = GROUP_KF_PAY_FREQUENCY
    ELEMENT_TYPE_ID_PASSED = CURRENT_ELEMENT_TYPE_ID
    annual_rate = HCS_GET_SUPPLEMENT_RATE(ELEMENT_TYPE_ID_PASSED, PAY_EARNED_END_DATE, 'General Rate')
    annual_bal = ELEMENT_NAME_ASG_GRE_FYTD
    IF annual_bal = annual_rate THEN
    Amount = 0.00
    mesg = 'Contract amount '||TO_CHAR(annual_rate)||' fully paid for '||ASG_NUMBER
    ELSE
    Amount = annual_rate / TO_NUMBER(pay_frequency)
    If abs(annual_bal+amount-annual_rate) < 1 then
    Amount = annual_rate-annual_bal
    IF ELEMENT_NAME_ASG_GRE_RUN=0 THEN
    flat_amount = Amount
    + ELEMENT_NAME_ADDITIONAL_ASG_GRE_ITD
    + ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD
    ELSE
    ( flat_amount = Amount )
    ELSE
    (flat_amount = ELEMENT_NAME_REPLACEMENT_ASG_GRE_ITD + ELEMENT_NAME_ADDITIONAL_ASG_GRE_ITD
    + ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD
    clear_repl_amt = -1 * ELEMENT_NAME_REPLACEMENT_ASG_GRE_ITD
    IF ELEMENT_NAME_ASG_GRE_RUN = 0 THEN
    IF ELEMENT_NAME_ADDITIONAL_ASG_GRE_ITD <> 0 THEN
    clear_addl_amt = -1 * ELEMENT_NAME_ADDITIONAL_ASG_GRE_ITD
    IF flat_amount < 0 THEN
    (IF (PAYROLL_TERMINATION_TYPE WAS DEFAULTED AND
    BG_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND
    FINAL_PAY_PROCESSED = 'N') OR
    (PAYROLL_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND
    FINAL_PAY_PROCESSED = 'N') OR
    (PAYROLL_TERMINATION_TYPE WAS DEFAULTED AND
    BG_TERMINATION_TYPE = 'L' AND
    TERMINATED_EMPLOYEE = 'Y' AND
    LAST_STANDARD_PROCESS_DATE_PROCESSED = 'N') OR
    (PAYROLL_TERMINATION_TYPE = 'L' And
    TERMINATED_EMPLOYEE = 'Y' AND
    LAST_STANDARD_PROCESS_DATE_PROCESSED = 'N') THEN
    neg_earn = -1 * ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD
    ELSEHuman Resource Management (HRMS)
    (neg_earn = flat_amount - ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD
    flat_amount = 0
    ELSE
    (IF ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD <> 0 THEN
    neg_earn = -1 * ELEMENT_NAME_NEG_EARNINGS_ASG_GRE_ITD
    IF (PAYROLL_TERMINATION_TYPE WAS DEFAULTED AND
    BG_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND FINAL_PAY_PROCESSED = 'N') OR
    ( PAYROLL_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND FINAL_PAY_PROCESSED = 'N') OR
    (PAYROLL_TERMINATION_TYPE WAS DEFAULTED AND
    BG_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND FINAL_PAY_PROCESSED = 'Y'
    AND RUN_TYPE != 'R') OR
    ( PAYROLL_TERMINATION_TYPE = 'A' AND
    TERMINATED_EMPLOYEE = 'Y' AND FINAL_PAY_PROCESSED = 'Y' AND
    RUN_TYPE != 'R') THEN
    (STOP_ENTRY = 'Y'
    mesg = ' ELEMENT_NAME earning has been stopped for this assignment.'
    ln_calc_meth = SET_ALTRNT_FLAT_RATE_CALC_METH('NOT_APPLICABLE','NOT_APPLICABLE')
    if (1 = 1) then (
         soe_run = ELEMENT_NAME_ASG_GRE_RUN
         soe_ytd = ELEMENT_NAME_ASG_GRE_YTD
    RETURN flat_amount, clear_addl_amt, clear_repl_amt, neg_earn, STOP_ENTRY, mesg
    Can anyone help me in solving this problem. Any kind of pointers would be helpful.
    Thanks
    Pradeep.

    Hi Pradeep,
    Hope you created the new element using the 'Earnings Template' form. If it is created using the 'Earnings Template' form then the calculation rule
    should be correct. You said you are modifying the new element formula by using the existing element formula code, have you checked if the
    formula code to the old and new once have changed anything other than the element name and standard input elements reference. Try to use
    the debug messages in formula and see if that give you any clue. You should find the document in metalink how to debug a formula.
    Thanks,
    Satin

Maybe you are looking for