ADF : Groovy Expression

Hi
Is it possible to reference the current entity object name using groovy? I would like to get the entity name in a validator to customize the error message.
I currently have a validator and an error message with two placeholders,
Attribute {0} is not allowed to be referenced on {1},
Placeholder {0} is being resolved using, source.hints.AttributeName.label, I cannot find a suitable expression to resolve placeholder {1}.
Thanks.

Hi,
Can you try
adf.object.getDefinitionObject().getAliasName()-Arun
Untested

Similar Messages

  • ADF Groovy Expression with bind variable and ResourceBundle

    Now I have ViewObject which have WHERE clause with bind variable.
    This bind variable is for language. Within bind variable I can change Value Type to Expression and into Value: I put +(ResourceBundle.getBundle("model.ModelBundle")).getString("language")+.
    Now if I run Oracle Business Component Browser (on AppModule) this works. In my ModelBundle.properties there is language=1 name-value pair. And with different locale I have different language number.
    Now if I put that ViewObject on one JSF, this bind variable expression does not work any more. Error:
    *oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.util.MissingResourceException, msg=Can't find bundle for base name model.ModelBundle, locale my_locale*
    Any ideas?
    10x
    Zmeda

    The most wierd thing is that, if I make ViewObjectImpl and insert this method
    public String getLanguage() {
    return (ResourceBundle.getBundle("model.ModelBundle")).getString("language");
    and call it in Bind Variable Expression Value: viewObject.getLanguage()
    IT WORKS!
    But why with groovy expression it does not work?
    Zmeda

  • ADF Groovy Expression for calculation

    Hi,
    I am using JDeveloper 11gR2. For a transcient attribute in a VO, I must add an expression that will calculate and return a value according to a business rule.
    I.e. if 'Standard' then column a * 0.3 or column b * 0.3
               elsif 'Premium' then column c * 0.3
               else 'Luxury' then column d * 0.3 Of course, using the appropriate Groovy expression. Does anyone have an example I could try?
    Thanks!
    Edited by: user545194 on 02.02.2013 07:28

    for example if att is the attribute that you want to calculate and it depend on val attribute
    the groovy exp is done on att
    if(val=='Standard') return a * 0.3
    else if(val=='Premium') return c * 0.3
    else if(val=='Luxury') return d * 0.3
    you must add attribute val, a, c ,d to the dependent attribute
    hope it helps
    Fakhri

  • (Groovy Expression) Get the no. of days between two dates

    Hi All,
    I am using ADF-BC-11g to create an entity object with 2 specific columns ActualDate and EstimatedDate both of Date type. I also want an additional field DaysBetweenTwoDates showing the difference between these two dates. Hence, I add another attribute DaysBetweenTwoDates in my entity object and after removing the Persistent property, I modify the expression field as ActualDate - EstimatedDate. When I test my AM, I get an error as below:
    *(oracle.jbo.JboException) JBO-29000: Unexpected exception caught: groovy.lang.MissingMethodException, msg=No signature of method: java.sql.Date.minus() is applicable for argument types: (java.sql.Date) values: {2009-04-01}*
    Can anyone please tell me how to achieve the same?
    Please note that I can not add a new column DaysBetweenTwoDates in the table nor can I have a new VO attribute subtracting and storing the difference as there are some logical and refreshing constraints.
    Any suggestions would be really helpful.
    Thanks
    Neeraj

    Thanks John,
    Oops...I did not think on this ground at all. Thanks for directing towards right direction. However, just to know, is that possible anyways thorugh groovy expression? Do we have any docs where we can search for the functions available in groovy expression?
    Regards,
    Neeraj

  • Accessing AppModuleImpl methods from Groovy expressions?

    From a VO View Criteria bind variable I'm attempting to call an accessor (aka. getValue) in it's parent AppModuleImpl, via a Groovy expression. I thought I could do something like:
    ((model.AppModuleImpl)object.getApplicationModule()).getValue()
    ...but at runtime I'm getting an error that Groovy doesn't know model.AppModuleImpl.
    I must be missing something here. Does anybody have the Groovy syntax for calling methods in the parent AppModuleImpl please? I've searched Grant Ronald's ADF Groovy whitepaper with no success, and I haven't found an example on these forums either.
    With thanks,
    CM.
    PS. JDev 11.1.1.2.0, ADF BC + ADF Faces RC

    Hi,
    I am not sure but may be you found this post useful http://andrejusb.blogspot.com/2010/01/storingaccessing-objects-in-adf-bc.html
    one more thing i did lately you can try if it works
    I created Method in AppModuleImpl class and called it in VOImpl class with AM object and then assigned it as expression to the attribute value in VO it should work for Bind variable value as well
    //Method in AM
      public String sayHello(){
        return "Hello World";
    //Method in VOImpl
      public String getHelloFromAM(){
        AppModuleImpl am = new AppModuleImpl();
        return am.sayHello();
    //Attribute "HelloTEXT" default value
    adf.object.getHelloFromAM()Hope it the same thing you are looking for
    Baig
    Edited by: BaiG on Jul 12, 2010 1:02 PM

  • Groovy expression for fetching current user details

    I have created a view object that retrieves user details from the database. Also for dynamically getting the details of the current user logged in i have defined a bind variable currentUser and the default expression is adf.context.securityContext.userName.When i give the fixed literal value as user name the details are fetched. However details are not fetched when i use the groovy expression. Can i get some help on this please.
    Regards

    details are not fetched when i use the groovy expressionby using groovy you cant the details
    i cant get you, is this you question?
    some hints, here
    groovy expression as default value in a Entity's Field Problem

  • Groovy expression for error message in validation

    hi...
    using groovy expression i want to display a dynamic error message...(ie.i have a date field the date cant be a past date..if i enter the past date like (02-04-2012 )the error message should display with this date)

    For a validation rule on an entity attribute, you can use a Groovy expression to decide whether
    an error or a warning message should be displayed using the following expression:
    adf.error.raise("THIS_IS_AN_ERROR_MESSAGE")
    adf.error.warn("THIS_IS_A_WARNING_MESSAGE")
    In your case, you can customize the message and access the date attribute in the message as source.HireDate(Assuming HireDate is the date attribute)
    Hope it helps.

  • Using groovy expressions to get a value of the current row

    Hi,
    I have a bounded task flow. The first step in the flow is calling an ExecuteWithParameters on one of my views. Based on the result of this query, I want to go to either Page1 or Page2.
    So I have a router. I first tried to route based on whether or not the result of the query contained only one row. That worked fine. But I want to add a condition to that.
    Basically, if the query returns one row AND that row has an attribute named 'Noc' == 1, then I want to go to Page2. Otherwise, go to Page 1.
    Right now to get the estimatedRowCount I am getting the iterator from the pageDef file created for my ExecuteWithParams object. To see if 'Noc' == 1, I tried this:
    #{data.rcl_view_reimbCode_search_results_task_flow_reimbCode_search_results_task_flow_ExecuteWithParamsPageDef.ReimbCodeSearchView1Iterator.currentRow.getAttribute("Noc") == 1}
    But it is complaining of grammar issues.
    What is the best way to go about getting the value of my attribute in a groovy expression?
    Thanks,
    Joel

    Hi,
    the best way is to use a managed bean reference
    1. create a binding for the router
    2. Expose the queried iterator in the PageDef file
    3. write a managed bean that accesses the binding
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentEntry();
    DCIteratorBinding iter = bindings.get("NameOfIterator");
    // i) get estimated row count
    // ii) get attribute value
    //iii) evaluate
    // iv) return true/false
    Reference the managed bean from the router
    Frank

  • Groovy expression evaluation

    Hi,
    The following groovy expression is returning null when validating attribute. If I use (PolicyNum > 2000000) in the if condition it is working fine. If use (newValue < MaxManualClassEndDate) in the if condition that is also working as expected. if I combine these two conditions using && it is failing. Can you please suggest right way to merge two expressions using groovy.
    if ( (PolicyNum > 2000000) && (newValue < MaxManualClassEndDate)) {
    print "Policy Term EffDate $newValue is less than $MaxManualClassEndDate";
    return false;
    Thanks and Regards,
    S R Prasad

    Can any one help in resolving the groovy expression.
    It is not working when there is && in the if condition between two expressions.

  • Re:Groovy Expression for time

    Hi All,
    Iam using Jdeveloper 11.1.2.3.0 ,my requirement is that :Groovy expression for time
    Can any one send me the above requirement
    Thanks,
    Sandeep

    What time?
    Yesterday noon?
    Now?
    You need to give us a use case.
    Check out GroovyCookbook: Dates and Times
    Timo

  • Groovy Expression at instance level.

    Hi,
    Iam using JDev 11.1.1.5.0.
    I've an ViewObject and then applied ViewCriteria. Now I want to apply groovy expression sum(column1). Is it possible? Please suggest, if you have any clue.
    Thanks,
    Samba.

    Hi,
    Going through this would give you the basics of groovy expressions : http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf
    -Arun

  • Groovy Expression Issue

    Hi,
    JDeveloper version: 11.1.1.3.
    I am setting the bind variable value using the below Groovy expression but the issue it is always setting the value "anonymous" instead of logged in user.
    viewObject.DBTransaction.session.userPrincipalName.toUpperCase()
    Note: Same is working fine in 11.1.1.2 version.
    Thanks.

    Hi,
    Thanks for the reply.
    Document says the following but I am not sure how to use incase of setting the bind variable for a VO.
    Application Module Returns Anonymous User After Logged In (9546149)
    Web applications using getUserPrincipalName() from ApplicationModuleImpl or SessionImpl may get 'anonymous' after user already logged in. Use ADFContext.getCurrent().getSecurityContext().getUserName() instead. Entities with histoty column kinds Created By and Modified By should override getHistoryContextForAttribute() in the entity impl class as follow:
    protected Object getHistoryContextForAttribute(AttributeDefImpl attr) {
    byte historyKind = attr.getHistoryKind();
    if ((historyKind == AttributeDefImpl.HISTORY_CREATE_USER) ||
    (historyKind == AttributeDefImpl.HISTORY_MODIFY_USER))
    Thanks.

  • Entity validation with groovy expression

    Hi,
    I'm using jdeveloper 11.1.2.3.0
    I have an entity object with two attributes "status" and "reason".
    Only in case the user select status id "4" I would like to validate that he will select also reason.
    for this I was trying to add entity validation with groovy expression.
    so I added this expression "Status== 4 && Reason == null" and also I added failure message.
    But it doesn't work as I expected.
    The error is displayed every time, also when the user select status that is not 4 and also when he select status 4 and the reason is not null.
    How should I write this groovy expression?
    Thanks

    Just to clarify,
    If you add this validation to your status attribute then it will validate that Reason is not null when you change the status to 4.
    If you want to raise an entity validation just add a new Entity Validator and the expression should be something like what you had:
    But slightly different
    Status != null ? (Status==4? (Reason!=null) : true) : true

  • Error in groovy expression: Illegal type in constant pool

    Hi,
    I intermittently get this error on my page:
    EMGC_OMS1 ERROR] [ http://oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator [tid:
    userId: SYSMAN ecid: 004emUHK7jA9XbWLHyl3if0002JD0011gG,0:1 APP: emgc URI: ... ... ... :Server Exception during PPR, #15[[ javax.servlet.ServletException: java.lang.VerifyError: (class: org/codehaus/groovy/runtime/ArrayUtil, method: createArray signature: ()[Ljava/lang/Object;) Illegal type in constant pool
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    Caused by: java.lang.VerifyError: (class:
    org/codehaus/groovy/runtime/ArrayUtil, method: createArray signature:
    ()[Ljava/lang/Object;) Illegal type in constant pool
             at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
             at bc4j.oracle_sysman_core_event_console_uimodel_view_IssueListVO_PriorityLocalizedLabel_null.gs.run(bc4j.oracle_sysman_core_event_console_uimodel_view_IssueListVO_PriorityLocalizedLabel_null.gs.groovy:1)
             at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1208)
    The IssueListVO getPriorityLocalizedLabel uses a groovy expression:
    oracle.sysman.core.event.common.uimodel.util.MetadataUtil.getPriorityLabel(Priority.intValue()).
    The Priority field is defined to be numeric, and the repository data shows all records having a value of 0, so this groovy expression should behave correctly.
    We are using Build JDEVADF_11.1.1.5.0_GENERIC_110409.0025.6013.
    Any ideas on how to resolve this?
    Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    cn u chk this
    LinkageError

  • Adding two expressions in ADF Groovy

    Hi All,
    I want to add two expressions in Groovy given as below. Is a Groovy reference link available for starters. Basically the below expression gives eg: "3+4" instead of 7.
    #{bindings.DefibrillationNoAmsShocks.inputValue}+#{bindings.DefibrillationNoOtherShocks.inputValue}
    Thanks

    What is the datatype of the attributes DefibrillationNoAmsShocks, DefibrillationNoOtherShocks?
    In Jdeveloper 11.1.1.4, If the datatype is of type oracle.jbo.domain.Number, both these expressions provides the desired results:
    "#{bindings.DefibrillationNoAmsShocks.inputValue.value + bindings.DefibrillationNoOtherShocks.inputValue.value}"
    "#{bindings.DefibrillationNoAmsShocks.inputValue.data + bindings.DefibrillationNoOtherShocks.inputValue.data}"Thanks,
    Navaneeth

Maybe you are looking for

  • Display compounded InfoObject value in BEX selection screen

    Hi people, Problem in 7.0 I have Costcenter compounded with Plant and I am using Costcenter for Selections in the BEx varaible screen. After running the report, in the selection screen value help, only the value of Costcenter is displayed, not the co

  • Mac Mini and Bluetooth Keyboard and Mouse

    I have a Mac Mini as a server. I've decided to do a clean install of Mountain Lion and Mountain Lion Server. I don't have any wired keyboard or mouse and am having trouble getting the Mac Mini to see the keyboard and mouse. I can buy cheap wired ones

  • Contribute CS4 authplay.dll error on launch

    Clean install of newly purchased Contribute CS4 on client system that exceeds system requirements. Upon initial launch, error RE: authplay.dll and program goes not further than initial splash screen. Can only kill the process at that point to close i

  • I updated to flash 11.7.700.224 and now cannot play DoubleDown Casino Slots while in Facebook.

    Anyone know why I can no longer play DoubleDown Casino Slots while in Facebook after upgrading to Flash 11.7.700.224?

  • Problem about the new laptop g570

    Hey there I just got this refurbished new laptop today but I find out the speaker have some problems. It can not speak any thing(the earphone is OK anyway) I do not know how to do it, oh god , i know it is refurbished things and the price is good but