Using StartsWith for String Comparision in Business rules

hi,
I need to compare whether a particular string starts with some pre-defined prefixes. These are bound to change from time to time and hence we wanted to use the business rule engine for this. We declared prefixes using "list of values" vocab and
defined the set. Now, I hoped to use the String.StartsWith() method but couldn't understand if it can be used.
As of now, we are creating a method and that will be called with 2 parameters. One the string and other is one of the list of values which we want the string to start with. Is there any better way to do this?
Praveen Behara
MCST : BizTalk Server 2006 R2, 2010

Hi Murugesan,
I need to match a particular series of numbers... say 12xxx,345xxx,567xxx. I am creating a
Series as a list and the valid values would be 12, 345, 567. I intend to keep them as prefixes i.e. they are not regular expressions. So, they won't be 12.*, 345.*, 567.*. The idea is to keep the vocab close to requirement
and away from implementation (typically, for a business user). Now, if I want this setup, how will the implementation with
Match look like?
Technically, your above solution would work.. but my way of implementation / thought process is for a different purpose.
Praveen Behara
MCST : BizTalk Server 2006 R2, 2010

Similar Messages

  • Using third party jars with Oracle Business Rules

    Hi
    I am working on Oracle AS 10g release 2.
    We are using Oracle Business Rules in integration with Oracle BPEL.
    While using third party jars however, Oracle Business Rules end is facing errors.
    Error during unmarshallingProvider com.sun.xml.bind.ContextFactory_1_0_1 not found
    oracle.classloader.util.AnnotatedClassNotFoundException:
    Missing class: com.sun.xml.bind.ContextFactory_1_0_1
    Dependent class: javax.xml.bind.ContextFinder
    Loader: oracle.xml:10.1.0_2
    Code-Source: /D:/oracleasr3/lib/xml.jar
    Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in D:\oracleasr3\j2ee\home\oc4j.jar
    Can anybody help in figuring out where Jaxb jars(3rd party jars) are to be kept so that OAS access it?
    We tried using the applib folder to load the jars but we are getting class loading errors.
    When new instances are created, class loading is not happening.
    Pls help.
    Thanks
    Kavya

    Are you using Application Server Release 3 or Release 2? There are different versions listed in your mail.
    I think you probably want to add this as a shared library via EM and then import the shared library to your application with the application's xml config files.

  • Syntax for using AND with a variable in Business Rule Source

    I've never fully gotten my head around the AND/OR syntax of calc scripts. What I'd like to do is as follows in some basic pseudo code:
    FIX( ("A97" AND [Selected_Entity]) OR ("B76" AND [Selected_Entity]) OR ("C63" AND [Selected_Entity]) ).
    I want my webform's business rule to execute on the selected Entity in the form (eg. A97) ONLY if that entity is part of a restricted list of members (in this case, 3 entities out of 200).
    Thanks for any advice!

    Hi,
    I am not sure if I have totally understood what you are trying to achieve so sorry if I have misread it.
    But what you could do is set up a variable in the Bus Rule, lets call EntVar.
    It is set up as a local variable of type member and dimension Entity with a run time prompt "Enter Entity"
    Now in your script it could look something like this....
    FIX(&CurrentYr, "Working".......)
    "AccMember"(
    IF(@ISMBR(&#91;EntVar]) AND (&#91;EntVar]=="A97" OR &#91;EntVar]=="B76" OR &#91;EntVar]=="C63") )
    AccMember=.......;
    ENDIF
    ENDFIX
    Once you have tested the business rule, you can get your form to pass through the entity into the variable.
    Is this what you are trying to do?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Use of other dimension filter in business rule

    Hi,
    I have a requirement to create two eliminations and adjustment business rules, one of which should only run for a specific category and the other should run for all other categories. I thought I could use the other dimension filter for this and on the first rule CATEGORY=ACTUAL is accepted by the system. However, on the second rule I entered CATEGORY<>ACTUAL and when I save the rule I get an error saying that CATEGORY<>ACTUAL is not a valid logical expression.
    As we have a number of categories I really do not want to create a rule for each one, so does anyone know a way to create a rule for all but one of my categories?
    Thanks,
    Arnold

    Hi Vadim,
    we currently have around 20 categories (plus ACTUAL) and we get two new every year for multi year plan/forecast. If only = works I would have to create one very long string for the second rule and add to it very year.
    I will try it though and if you are correct I might have to open a note with SAP.
    Thanks,
    Arnold

  • Using a local Array in a Business Rule

    Newbie question here...
    I am writing a business rule that applies a standard rate to a lot of different lines in a business rule. This rate only varies by year, so from a logical perspective I think of it as a 1 dimensional variable. However the rate is actually stored in my normal Essbase cube (8-dimensions) something like the following:
    Dimension Dimension Member
    Account: Rate
    Dim2: No Dim2 Value (A dimension member called "No dim2 Value")
    Dim3: No Dim 3 Value
    Dim4: No Dim4 Value
    Dim5: No Dim5 Value
    Dim6: No Dim6 Value
    Dim7: No Dim7 Value
    Year: [varies by year]
    So right now my formula to calculate things looks something like the following:
    "Target Account 1" = "Driver Account 1" * Rate ->
    "No Dim2 Value" ->
    "No Dim3 Value" ->
    "No Dim3 Value" ->
    "No Dim5 Value" ->
    "No Dim6 Value" ->
    "No Dim7 Value"
    But I have to do this for several "Target" and "Driver" Accounts in the rule, which means an ugly looking rule. What I would like to do is create a local array at the beginning of my business rule and populate it with the rate:
    ARRAY _rate[Year]
    and then set the value of the array equal to
    Rate -> "No Dim2 Value" -> "No Dim3 Value" -> "No Dim3 Value" ->
    "No Dim5 Value" -> "No Dim6 Value" -> "No Dim7 Value"
    This will allow me to simplify my formula down to
    "Target Account 1" = "Driver Account 1" * _rate
    My first question is "can I do this?" I've been able to create an array and use it in the formula, but I can't figure out how to populate the values in the array from my main Essbase cube.
    The second question is "does it make sense to do this?" In addition to making the code easier to read, my guess is that populating the array once and just using it within the scope of the rule would be a bit more efficient than referencing that big cross dim expression, but I really don't know.
    Any advice anyone has would be appreciated.
    Thanks
    -Glenn

    I am familiar with what you are trying to accomplish.
    Having Essbase store a fixed rate over time to be used in calculations is possible. However formulas start to look complex depending on how many dimensions you have and what the desired outcome is.
    There are alternate techniques to the one you mentioned.
    You can create a new database for rates only and make it with fewer dimensions. Then use the @XREF function to retrieve it in your formulas.
    If the rate doesn't change very often you can put the Rate inside of the formula as is.
    For example Y2006_Rate = 5%.
    Brian Chow

  • Using Y-T-D values in Business Rules

    Hi All,
    I am using Hyperion Planning 11.1.1.1.0.
    I have enabled Y-T-D dynamic time series in the application.
    I need to calculate YTD variance% , the formula to be used is :
    (Y-T-D(Oct)Budget - Y-T-D(Oct) Actual) / Y-T-D(Oct)Budget * 100.
    I have a business rule(created in EAS) that does the other variance % calculations which are pretty simple like Budget-Actual/Budget*100.
    The formuls for the normal variance Percentage works but i get an error when writing a formula for :
    "Variance%(YTDActual&YTDBudget)"
    ("Variance%(YTDActual&YTDBudget)"="Y-T-D(&CurrentMonth)"->Budget - "Y-T-D(&CurrentMonth)"->Actual / "Y-T-D(&CurrentMonth)"->Budget *100;)
    The error that comes up is as follows:
    Detail:Cannot calculate. Analytic Server Error(1200497): Error compiling formula for [Variance%(YTDActual&YTDBudget)] (line 2): unknown member name ["Y-T-D(&CurrentMonth)"] in function [operator @X]
    Can somebody please advice as how to use Y-T-D values in the formulas?
    Kind Regards.
    Mirka

    Here are a couple of tips that may help:
    1) You cannot directly reference dynamic-time-series members in a business rule or a member formula. These are "virtual" members. This is a common misconception.
    2) Even if you could reference these members in a formula, you couldn't store a value in them anyway, as they are dynamic.
    3) It usually doesn't make a lot of sense to calculate variances like these in a business rule. I would recommend making them dynamic, two-pass member formulas (not business rules) in your Scenario dimension. They don't need to be "Two pass" in the typical sense (eg. recalculating a ratio at the quarters), but they need to fire last, so set them as two pass. (otherwise you will end up with order of calculation issues where other calculations fire after the variance and you get incorrect results).
    In looking at your requirement, you don't really need a variance that calls out dynamic time series members. Simply create a variance scenario with a formula like @VARPER("Budget", "Actual");. If you have "Y-T-D(Oct)" selected as your time period in your form or spreadsheet, and "Bud vs Act %" (this is your new variance scenario) selected, it will calculate the YTD variance for October, or whatever time period you have selected.
    Just to recap:
    1) Create a new scenario called "Bud vs Act %". Make it dynamic and two-pass. Give it a formula of @VARPER("Budget", "Actual");
    2) Scrap your business rule. Add other variance scenarios as needed.
    3) Add your YTD member and your variance scenario to a form, and test.
    Hope this helps,
    - Jake

  • Use of JSR-94 in oracle business rule

    I am developing an application using oracle business rules .
    I want to create a JSR-94 Rule Execution Set from Rule Sets in a Dictionary
    and want to run the application through created rule execution set.
    I have taken reference form OracleBusinessRulesUsersGuide.pdf but unable to
    run the installed_dir\rules\demo\car demo through the rule execution set.
    U can take the reference of car demo
    with regards
    saleem khan

    Hi,
    Thnaks for your reply but I've already tried with that and as I've mentioned above, it would return you an integer representing the day of the week;not the day.
    Thanks
    Edited by: user11930797 on 20 Sep, 2011 8:22 PM

  • Is it possible to use "not" logical operator in a Business Rule Condition?

    This seems like a very simple request to me, but I cannot see any other questions/answers about it.
    Can I add a "not" to my Conditions in a Business Rule?
    My scenario is that I have a core Entity with a Type.  The Type is a domain attribute with a Code and Name.  The Code of the core Entity should in the form 'AA-9999', where 'AA' is the Code from Type.
    The idea is that I have a business rule with the condition "not
    Code starts with DBA.Type.Code" and the Action would be "Code is not valid".
    Is this possible?  Is there a better way of implementing this?
    Thanks,
    Michael

    Yeah! This is the board in question! But it has lots of versions, like K7T Pro, K7T Pro2 (my one!), K7T Turbo, K7T Turbo Limited Edition and K7T Turbo2, all of then are WS-6330 Lite...   They phisically diferent, but the BIOS seens to be the same... I want to know is this feature in the newer version is going to work or not on my board (MS 6330 Lite K7T Pro2 Ver:1) ....
    Doesn´t matter what board you choose (PRO, PRO2, Turbo, Turbo2) the MSI page shows all the same BIOS to Download... But I think that this feature is only applicable for K7T Turbo2, but will make no difference in my! At least that´s what I think...
    But you´re right! The board that I have is the one on the link you said!
    Thanks!      

  • Program for string comparision in ABAP

    Hi,
    I require a program in abap for string comparision

    Comparing Strings
    Similarly to the special statements for processing strings, there are special comparisons that you can apply to strings with types C, D, N, and T. You can use the following operators:
    <operator>
    Meaning
    CO
    Contains Only
    CN
    Contains Not only
    CA
    Contains Any
    NA
    contains Not Any
    CS
    Contains String
    NS
    contains No String
    CP
    Contains Pattern
    NP
    contains No Pattern
    There are no conversions with these comparisons. Instead, the system compares the characters of the string. The operators have the following functions:
    CO (Contains Only)
    The logical expression
    <f1> CO <f2>
    is true if <f1> contains only characters from <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that does not occur in <f2> .
    CN (Contains Not only)
    The logical expression
    <f1> CN <f2>
    is true if <f1> does also contains characters other than those in <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that does not also occur in <f2>. If it is false, SY-FDPOS contains the length of <f1>.
    CA (Contains Any)
    The logical expression
    <f1> CA <f2>
    is true if <f1> contains at least one character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that also occurs in <f2> . If it is false, SY-FDPOS contains the length of <f1>.
    NA (contains Not Any)
    The logical expression
    <f1> NA <f2>
    is true if <f1> does not contain any character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that occurs in <f2> .
    CS (Contains String)
    The logical expression
    <f1> CS <f2>
    is true if <f1> contains the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
    NS (contains No String)
    The logical expression
    <f1> NS <f2>
    is true if <f1> does not contain the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
    CP (Contains Pattern)
    The logical expression
    <f1> CP <f2>
    is true if <f1> contains the pattern <f2>. If <f2> is of type C, you can use the following wildcards in <f2>:
    for any character string *
    for any single character +
    Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
    If you want to perform a comparison on a particular character in <f2>, place the escape character # in front of it. You can use the escape character # to specify
    characters in upper and lower case
    the wildcard character "" (enter # )
    the wildcard character "" (enter # )
    the escape symbol itself (enter ## )
    blanks at the end of a string (enter #___ )
    NP (contains No Pattern)
    The logical expression
    <f1> NP <f2>
    is true if <f1> does not contain the pattern <f2>. In <f2>, you can use the same wildcards and escape character as for the operator CP.
    Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
    DATA: F1(5) TYPE C VALUE <f1>,
          F2(5) TYPE C VALUE <f2>.
    IF F1 <operator> F2.
       WRITE: / 'Comparison true, SY-FDPOS=', SY-FDPOS.
    ELSE.
       WRITE: / 'Comparison false, SY-FDPOS=', SY-FDPOS.
    ENDIF.
    The following table shows the results of executing this program, depending on which operators and values of F1 and F2.
    <f1>
    <operator>
    <f2>
    Result
    SY-FDPOS
    'BD '
    CO
    'ABCD '
    true
    5
    'BD '
    CO
    'ABCDE'
    false
    2
    'ABC12'
    CN
    'ABCD '
    true
    3
    'ABABC'
    CN
    'ABCD '
    false
    5
    'ABcde'
    CA
    'Bd '
    true
    1
    'ABcde'
    CA
    'bD '
    false
    5
    'ABAB '
    NA
    'AB '
    false
    0
    'ababa'
    NA
    'AB '
    true
    5
    'ABcde'
    CS
    'bC '
    true
    1
    'ABcde'
    CS
    'ce '
    false
    5
    'ABcde'
    NS
    'bC '
    false
    1
    'ABcde'
    NS
    'ce '
    true
    5
    'ABcde'
    CP
    'b'
    true
    1
    'ABcde'
    CP
    '#b'
    false
    5
    'ABcde'
    NP
    'b'
    false
    1
    'ABcde'
    NP
    '#b'
    true
    5
    goto sap library if intsalled in ur system and check the above one....

  • Use of decision table in Oracle Business Rule

    hello,
    I am using Oracle Business Rule beta version to develop a rule base application.
    I want to know that how i can make use of table to make decision on the basis of table data .
    thanx
    saleem

    hello,
    I am using Oracle Business Rule beta version to develop a rule base application.
    I want to know that how i can make use of table to make decision on the basis of table data .
    thanx
    saleem

  • Use Operator == for String Comparison

    Hi,
    I would like to know more about the impact of using operator == in String Comparison.
    From the reference I get, it state this :
    "Operator (==) compares two object addresses to see whether it refers to the same object."
    I've tested it with 2 codes as below :
    Code 1:
              String Pass1 = "cosmo";
              String Pass2 = "cosmo";          
    if (Pass1==Pass2)
                   System.out.println("1&2:same");
              else
                   System.out.println("1&2:not same");
    Output : 1&2:same
    Code 2:
              String Pass3 = new String("cosmo");
              String Pass4 = new String("cosmo");
              if (Pass3==Pass4)
                   System.out.println("3&4:same");
              else
                   System.out.println("3&4:not same");
    Output : 3&4:not same
    Can anyone kindly explain why is the result so? If operator == compares the addresses, isn't it that the 1st code should also have the output :"1&2:not same".

    Can anyone kindly explain why is the result so?It's an implementation artifact. Strings are pooled internally and because of that any String literal will be represented by exactly one object reference.
    Knowledge of this shouldn't be utilized though. It's safer to follow the basic rule: Use == to compare object references and equals to compare object values, such as String literals.

  • Using wildcards for String compare

    Hello,
    I want my prog to find out all Strings which start with the letters 'File'. How can I make a String compare by using wildcards ?
    Thanx,
    Findus

    You may use the String method startsWith to find strings beginning with File. eg. filename.startsWith("File")
    for more complicated comparisons you might want to use regular expressions.

  • Using variables in Calc scripts and Business Rules

    I am sure there have been previous discussions about this, but can somebody let me know the benefits of using variables in Calc scripts and BRs?
    Thanks,
    A

    I have never used calc variables and after reading a study guide, which talked about them, I couldn't really understand the benefits.^^^I use variables all the time to make abstract difficult formulas. Below is an example.
    /*     Declare variables     */
    VAR varSalaryCosts ;
    VAR varProdOHLabXXXX ;
    VAR varXXXX ;
    A whole bunch of code here along with very limited FIX statement and then...
    "Salaried Labor"
         varSalaryCosts = "Salary Costs"->"No Department"->"No Category"->"Salaried" -
                             "Wage Bonus"->"No Department"->"No Category"->"Salaried" -
                             "YYYY Retention Bonus 40%"->"No Department"->"No Category"->"Salaried" -
                             "YYYY 60% Ret Bonus Accrual"->"No Department"->"No Category"->"Salaried" ;
         varProdOHLabXXXX = "Number of Employees"->"ZZZZDepartments"->"Codes"->"Salaried" +
                             "Number of Employees"->"Blah Departments"->"Codes"->"Salaried" +
                             "Number of Employees"->"Humph Departments"->"Codes"->"Salaried" +
                             "Number of Employees"->"TTTT"->"Codes"->"Salaried" ;
         "Salaried Labor" = varSalaryCosts * ("Number of Employees"->"Salaried" / varProdOHLabXXXX) ;
    )The last formula is how the formula was described to me by the business owner. I find it to be much easier to read than something like:
    "Salaried Labor" = ("Salary Costs"->"No Department"->"No Category"->"Salaried" -
                             "Wage Bonus"->"No Department"->"No Category"->"Salaried" -
                             "YYYY Retention Bonus 40%"->"No Department"->"No Category"->"Salaried" -
                             "YYYY 60% Ret Bonus Accrual"->"No Department"->"No Category"->"Salaried") *
                             ("Number of Employees"->"Salaried" /
                             ("Number of Employees"->"ZZZZDepartments"->"Codes"->"Salaried" +           
                             "Number of Employees"->"Blah Departments"->"Codes"->"Salaried" +
                             "Number of Employees"->"Humph Departments"->"Codes"->"Salaried" +     
                             "Number of Employees"->"TTTT"->"Codes"->"Salaried")) ;I have used ARRAY in a really-cool-but-alas-not-invented-by-me calc script to do currency conversion in Planning better than Planning does currency conversion. (How's that for a run-on sentence?) It is one of the six blog posts I am working on and I will finish it soon, I hope. I am sort of in thrash mode right now. It does have its uses and I'll try to remember to update this thread when I'm done.
    Regards,
    Cameron Lackpour

  • Using concat for STrings

    I'm trying to concat a specified string, ".jpg", to a string of the form:
    filestring = afile.getName();
    filestring.concat(".jpg");
    Why does it not add the .jpg to the end of what filestring is?

    Cuz Strings are immutable dingbat. If you'd read the api you might notice concat returns a new string with the value you want, but you're chucking it since you didn't assign the result to a variable.
    Options:
    1) filestring = afile.getName() + ".jpg"
    2) filestring = afile.getName().concat(".jpg");
    3) filestring = afile.getName(); filestring = filestring.concat(".jpg");
    3) use StringBuffer instead

  • Using CharAt for String Manipulation

    Hi,
    I am new to Java and am taking a Java class. I am trying to put a social security number in "nnn-nn-nnnn" format where n is a digit 0-9. I don't know if it would work with the charAt method of the String class. Does anyone have any suggestions on how to implement this kind of manipulation.
    It would be greatly appreciated!
    Thanks,
    waggypup99

    You could just create a class for social security number.
    e.g.
    public class SSNum{
        private int _num;
        public SSNum(int number){
          _num = number;
          * take number in the form  nnn-nn-nnnn
        public SSNum(String number){
          StringTokenizer st = new StringTokenizer(number,"-");
          StringBuffer numStringB = new StringBuffer(st.nextToken());
          numStringB.append(st.nextToken());
          numStringB.append(st.nectToken());
         _num = Integer.parseInt(numStringB.toString());
       public String toString(){
          //left as fun exercise
    }

Maybe you are looking for

  • SAP ISU - User exits at the end of move-in process

    Hi, We have a requirement to send some outbound messages on completion of Move-in process in SAP ISU system. And send some outbound message on completion of Reverse Move-in process.   I tried to find the customer/user exit in transaction EC50E and EC

  • Task Flow Exit Using contextual Events ??

    I am using Jdeveloper 11.1.1.5. My application has a page which has two regions in it. First region has a bounded task flow with just one fragment in it(Just with a button) and Second region has a BTF which has five fragments in it(which is a kind of

  • Copy and paste issue

    While trying to create a simple copy and paste function ( from one open document / image into another open document in Photoshop CS5 ) like: PsApp.bringToFront(); PsApp.activeDocument.selection.selectAll(); PsApp.activeDocument.selection.copy(); PsAp

  • Message (Error) 3518-13

    I am facing the following error No GL Account is selected asset account in business partner master data I have no clue that where i am supposed to find this GL. Kind Regards, OZAIR ANWAR SHAMSI

  • InDesign unexpectedly quits when trying to create pdf

    in Design and photoshop unexpectedly quit when i try to create a pdf from within the programs. what can i do to fix this? i can't even creat the pdf from acrobat because it says that the file type is either not supported or the file is damaged, but i