Validation using a DB function

Hi,
I am trying to add declarative validation for a field. The validation is a complex one whose logic resides in the database (let's call it is_valid_part).
There are 2 pages, first page they enter a part, and on the second they get some part info. I'm using a transient VO, and hoping to stop the user at the first page if the is_valid_part doesnt pass.
is_valid_part takes 2 parameters - the part number and the logged in user's ID.
I saw this blog: http://andrejusb.blogspot.com/2010/04/implementing-custom-generic-plsql.html, and other examples on custom validator using backing bean, but they dont talk about how you can pass any other value other than the value on the field (in this case part number). In my case I am trying to pass in both the part number and user's id, which will come from a backing bean.
I can write a method in the AM but I am trying to as declaratively as possible. Any suggestions?
Thank you
Kalp

Thank you. Looked at the page you provided, but it mentions that "For an attribute-level validator, the method must take a single argument of the same type as the entity attribute. " That is, it can only use the value of the part number, and I cant pass in user id. i'd said user id for simplicity, it's actually a user related ID that is coming from another transient attribute that stores that info, and I will pull that into a managed bean..
So is an AM method the only way to go? Or there is some other way to allow validation rule to accept 2 parameters?
thanks!
kalp

Similar Messages

  • How to process validations using PL/SQL function

    Hi.
    I created a page with a form to process DML operations against a database table. Also created a validation using PL/SQL function that returns a boolean value:
    declare
    v_dummy varchar2(1)
    begin
    select 'X'
    into v_dummy
    from s_customer
    where id = :p2_id;
    return (TRUE);
    exception
    when no_data_found then
    return (FALSE);
    when others
    return (TRUE);
    end;
    In this case i want to send a message to the user indicating that an certain row (the one with :p2_id value) already exists in the database. The piece of code above will do the job. If this function returns true, it means the row is in the DB already.
    The problem is that i don´t know what do to or how to tell htmldb that a TRUE value should issue a message or be processed as en error, whilst a FALSE means OK.
    How do i tell htmldb what to do?
    Suppose must do something with "expression 1" , "expression 2", etc.
    Any ideas???

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • Pre-validation using JavaScript cannot work in JSF?

    Sometimes we need to do pre-validation using JavaScript in some senarios that data need be entered and validated at client site before it reaches to Web Application Server. Remind that JSF is a server validation. Creator seems not to allow Developers to do pre-validation using JavaScript for any editable input fields in form. I will illustrate an example and hope anyone can help me to solve it out.
    Assume that if we write the a new web page that allows User enters Name and Phone. The pre-validation function called test() is written in JavaScript for validating field Phone. For simplicity, the below HTML/JavaScript without nested in table is a simple one for HTML form.
    <html>
    <body>
    <script language="JavaScript">
    function test(){
         if (form1.phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    <form name=form1>
    <input id="phone" type="text" size=20><Br>
    <input id="name" type="text" size=20><Br>
    <input type="submit" id="submit" onclick="test()" value="Submit">
    </form>
    </body>
    </html>
    Now, we consider using Java Studio Creator to generate the same form as describing above. The script is shown below:
    <?xml version="1.0"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html>
    <head>
    <title>testForm Title</title>
    </head>
    <body rave-layout="grid">
    <h:form binding="#{testForm.form1}" id="form1">
    <h:inputText binding="#{testForm.textField1}" id="phone" style="position: absolute; left: 192px; top: 96px; width: 168px; height: 23px"/>
    <h:inputText binding="#{testForm.textField2}" id="name" style="position: absolute; left: 192px; top: 144px; width: 168px; height: 23px"/>
    <h:commandButton binding="#{testForm.button1}" id="submit" style="position: absolute; left: 192px; top: 216px" value="Submit"/>
    </h:form>
    </body>
    </html>
    </f:view>
    </jsp:root>
    After running Script that Creator created, the HTML is generated and reduced (for simplicity) as follows:
    <f:view>
    <html>
    <body rave-layout="grid">
    <form action="/rave/rave" id="form1" method="post">
    <input id="form1:Phone" type="text"></input>
    <input id="form1:name" type="text"></input>
    <input id="form1:button1" value="Submit" onClick="test()"></input>
    </body>
    </html>
    </f:view>
    Take a look carefully at <input> elements. We see the syntax for naming for each "input" element that there is a semi colon added between form1 and phone or form1 and name. This syntax is generated from built-in JSF components. Hence, I rewrite the test() JavaScript function to match with the naming that Creator generated as follows:
    <script language="JavaScript">
    function test(){
         if (form1.form1:Phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    Clearly, this JavaScript cannot be worked because of a semi column that Creator has named it.
    I have tried to work arround for this but cannot find a solution except changing the name such as: from <input id="form1:phone" ...> to <input id="form1_phone" ..>. But I could not change or modify the scripts because it is generated from JSF components when running it under browser.
    I guess to solve this problem, the naming for elements in form should be reconsidered in the next release of Java Studio Creator.

    Hi Marie,
    I currently sucess in client pre-validation using JSF. I found a way to do it.
    Please take a look of how javascript has been added in the following scripts:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html lang="en-US" xml:lang="en-US">
    <head>
    <meta content="no-cache" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <title>login Title</title>
    </head>
    <body style="-rave-layout: grid">
    <h:form binding="#{login.form1}" id="form1">
    <h:outputLabel binding="#{login.componentLabel1}" for="componentLabel1" id="componentLabel1" style="position: absolute; left: 216px; top: 72px">
    <h:outputText binding="#{login.componentLabel1Text}" id="componentLabel1Text" value="Application System Name"/>
    </h:outputLabel>
    <h:panelGrid binding="#{login.gridPanel1}" columns="3" id="gridPanel1" style="position: absolute; left: 72px; top: 168px; width: 504px; height: 100px">
    <h:outputLabel binding="#{login.componentLabel2}" for="componentLabel2" id="componentLabel2">
    <h:outputText binding="#{login.componentLabel2Text}" id="componentLabel2Text" value="User Name: "/>
    </h:outputLabel>
    <h:inputText binding="#{login.textField1}" id="textField1" onclick="" style="width: 149px; height: 22px"/>
    <h:outputText binding="#{login.outputText1}" id="outputText1"/>
    <h:outputLabel binding="#{login.componentLabel3}" for="componentLabel3" id="componentLabel3">
    <h:outputText binding="#{login.componentLabel3Text}" id="componentLabel3Text" value="Password: "/>
    </h:outputLabel>
    <h:inputSecret binding="#{login.textField2}" id="textField2" style="width: 147px; height: 22px"/>
    <h:outputText binding="#{login.outputText2}" id="outputText2"/>
    <h:outputLabel binding="#{login.componentLabel4}" for="componentLabel4" id="componentLabel4">
    <h:outputText binding="#{login.componentLabel4Text}" id="componentLabel4Text"/>
    </h:outputLabel>
    <h:commandButton action="#{login.ok_action}" binding="#{login.button1}" id="button1" onclick="return checkUserIdentity(this.form)"
    style="width: 90px; height: 25px" value="OK"/>
    <h:outputLabel binding="#{login.componentLabel5}" for="componentLabel5" id="componentLabel5">
    <h:outputText binding="#{login.componentLabel5Text}" id="componentLabel5Text"/>
    </h:outputLabel>
    </h:panelGrid>
    </h:form>
    </body>
    <script type="text/javascript">
    function checkUserIdentity(form){
    var userName = form["form1:textField1"].value;
    var userPassword = form["form1:textField2"].value;
    if (userName == "") {
    alert("Please enter User Name.");
    form["form1:textField1"].focus();
    return false;
    if (userPassword == "" ){
    alert("Please enter password.");
    form["form1:textField2"].focus();
    return false;
    form.submit();
    return true;
    </script>
    </html>
    </f:view>
    </jsp:root>
    The key for getting data value from Form based on Javascripts is var userName = form["form1:textField1"].value;
    Thanks,
    VTT_

  • Valid Use of a Collection in SCCM

    I've read the contents of this post with much interest and would like to ask about whether my particular requirement is possible.
    When we build a server for the first time we need to ensure that it is not placed in collection with other production servers for obvious reasons. So I was thinking about creating a provisional collection
    container where we can place newly built servers pending the QA of the build. The container will resemble the Production Collection in every respect except who has permissions to perform maintenance tasks on the objects in the collection. So if there is an
    issue with the build and we need to delete the object or reset its maintenance flag, we don't risk inadvertently doing this to a normally functioning production server. That way we can also restrict who has the authority to maintain the collection to the build
    teams. Only when the server is fully functioning and provisioned in AD and formally handed to the run teams, will it be moved to the Production Collection.
    Is this a valid way to use Collections? If so is there any existing SCCM Task Sequence tool that will move servers between containers or do we need to develop one?
    Many thanks....

    Hi,
    It sounds like a valid use of Collections. There is no builtin tool to move a device from a collection to another, you could check out the Right Click tools for SCCM 2007 and see if there is one or, simply change one of the right click tools script to have
    that feature.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Use of Call Function Node vi, with char type pointer

    I want to be able to use a certain function from C++ DLL, and I followed the TOOLS>>IMPORT>>SHARED LIBRARY(.dll) wizard.  Where I located my header file and the dll file.
    However i am getting an error (1097).  This is the function with the paramaters:
    void Function_Name(unsigned char *L, unsigned char *H, unsigned in Len, unsigned char Adr);
    I don't think, that I configured my Call Function Node, correctly.  How should i set the paramaters settings of the first 2?  I have tried Numeric, unsigned (and signed) Int (32, 16), pass pointer value.  to accomodate the first two varaibles. 
    Please someone help, what should I do to accomodate the unsigned char pointers, so that I can used the function in labVIEW?

    Hi Safe,
    The error you're encountering has the following description (I'm sure you've already looked this up-posting here for clarity for other readers):
    LabVIEW:  An exception occurred within the external code called by a Call Library Function Node. This might have corrupted LabVIEW's memory. Save any work to a new location and restart LabVIEW.
    Typically, this happens for one of just a few reasons:
    Memory was overwritten (e.g. you passed a buffer of N bytes, but N+X bytes were modified, and an exception was thrown.
    A bad pointer was passed. (This is probably not the case.)
    Arguments were not passed to the function properly. (Calling conventions)
    Function wasn't called from the proper thread.
    Some other reason (only can be determined by inspecting in a debugger).
    I've attached some pictures of how I'd configure the dialog, but there are two critical things you have to know: calling conventions and thread safety. Those are things defined by the DLL. In Windows, C vs. 'Standard' (a.k.a. Pascal) calling conventions MUST be correct, as they affect how arguments are passed on the stack. If this is wrong, then, for example, where arg1 is expected to be an unsigned char *, you may actually only pass an unsigned char. Dereferencing that number as a pointer will at best crash, at worst appear to be a valid address and silently corrupt memory.
    I suggest double-checking the calling conventions. 'stdcall' is still quite common, but not the default setting in the Call Library Function dialog.
    Best regards,
    intvstefve
    intvsteve
    LabVIEW R&D
    Attachments:
    dllconfig11.JPG ‏40 KB
    dllconfig21.JPG ‏41 KB

  • Validation - calling a stored function

    Hi:
    I have a function stored in the database that returns a bouleon for validation.
    Using PL/SQL function returning bouleon for page level validation, what is the correct syntax to use in the expression to call the function:
    Thank you.
    Bruce

    Hi,
    Try
    RETURN your_function(:Px_YOUR_ITEM);Br,Jari

  • Using the "fit" function with "mFct" ?

    having a problem with declaring a function and using it in a nonlinear least squares fit:
    function Fit5(a,x,y)
    rslt5 = a[1]*(2.0*besselj(sqrt(.....;
    return rslt5;
    end function;
    [a, res1, q1, qVar1] = fit(g, Top_data, fit5, guess,,,iterMax,w,rho );
    getting the following error message:
    is not a valid signature for the function"fit"

    having a problem with declaring a function and using it in a nonlinear least squares fit:
    function Fit5(a,x,y)
    rslt5 = a[1]*(2.0*besselj(sqrt(.....;
    return rslt5;
    end function;
    [a, res1, q1, qVar1] = fit(g, Top_data, fit5, guess,,,iterMax,w,rho );
    getting the following error message:
    is not a valid signature for the function"fit"

  • MDG Cross entity validation using enrichment spot is not executed.

    I have configured the enrichment sport for cross entity validations and used BRF to validate the data, but looks like validations are
    not executed. I have the check activated for the step in the configuration and I can see my custom class is being picked in method GET_ENRICHMENTS of class CL_USMD_DQ_ACCESS_ENRICHMENT for that request type and step. I have flag relevant  selected and option “Execute Always” (will change this to “Execute when data changed).
    I am trying to figure out if SAP MDG standard code will execute my custom class code or not. I had put break point in my custom class constructor and this is called when an instance for enrichment is created in method GET_ENRICHMENTS of class CL_USMD_DQ_ACCESS_ENRICHMENT. However my code in below method is not executed (and hence BRF is not called)
      IF_USMD_ENRICHMENT_FEEDER~GET_ADAPTER_DATA
      IF_USMD_ENRICHMENT_FEEDER~IS_RELEVANT
    Now I am trying to figure out a place from where these enrichment class methods will be executed. I feel this will be from EXECUTE_ENRICHMENT
    of class CL_USMD_DQ_ACCESS_ENRICHMENT. But this method is also not executed when I hit on Check button. Am I looking wrong standard class?
    Is there anything I am missing in configuration? Or we need to implement any SAP note? I tried to find one, but no luck.

    Hello, I am not using cress entity BADI for Validation. I am using this BADI for cross entity derivations and they are working fine.
    I had a requirement to do cross entity validations, and I have rules written using the BRF+.
    I had used enrichment sport functionality to have a custom class used to call BRF functions and prepare the context with required entity data.
    Validations are supposed to happen based on the enrichment spot defined and the configuration for that enrichment sport on the process step level. This is not happening. let me know if you need more information on it,

  • Generate HTML format report using  DBMS_SQLTUNE.REPORT_TUNING_TASK function

    How could i generate HTML format report using DBMS_SQLTUNE.REPORT_TUNING_TASK function in oracle 11g

    See [url http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_sqltun.htm#CHDGEIHJ]documentation for DBMS_SQLTUNE.
    The TYPE parameter suggests that it would determine the format and whilst the nline documentation in the code (desc DBMS_SQLTUNE) suggests that valid values are TEXT, HTML and XML, it seems that this is not yet implemented. Whilst valid values of TEXT, HTML and XML are validated, only a TEXT report is produced.

  • Can I  use excel type functions embedded into an online pdf form, ie Qty x Price= total $

    Can I use excel type functions embedded into an online pdf form, ie Qty x Price= total $

    Let me tell you what I am sure about and what I am not sure about:
    I am sure that I want to be able to sell my products online. The industrial market that I sell to usually do not allow the maintenance people that find me on the web, do not have the ability to use credit cards in a typical shopping cart format due to the higher prices that the equipment I sell costs and that most people call me up to 'request a formal quotation' to give to their purchasing depart. So, my bright idea is to create numerous pdf files with very specific url's to match the very specific items that I sell. (1) item per pdf. I am thinking that the advantage to skipping the shopping cart approach and allowing the customer to fill in the qty of items, which would be mulitpled by the price of the item (a constant #) and then hitting a apply button, that would calculate subtotal price. Discounts for the qty the customer inputs (qty of items inputted by customer would be discounted on a percentage x base price) and a refresh the screen. It would allow for SEO advantages from what I have seen in the past in my very vertical market. All forms would be setup using the same functionality, just images, alt text, urls, and readable text would change.
    What I don't know- which is alot, then how to calculate shipping costs. I have a weight per item, which can be added up. I saw an Adobe blog that allows UPS shipping cost to be programmed in. I don't know how dreamweaver works, which was what the blog mentioned would allow for this updated, instantanious interface with UPS and calculating real shipping costs to a specific zip code. Shipping cost would be fluff to this page. The main thing would be to do allow the customer to be able to fill in a qty of the specific item on the page, calculate a discount if / then type thing, be able to have customer email to purchasing dept or print. I would date stamp it with verbage that pricing is valid for XX days and if I could get a copy emailed to me that would be icing on the cake. I believe that this non static pdf would be something different then the current competion and that it would allow for 100's of quotes to be generated without customers having to wait 15 minutes to an hour for me to process the exact document that they are looking for.
    Hajeks

  • Procedure to use the COPY function in Realignment

    Hi Gurus,
    Can anyone explain me the sequential procedure to use the COPY function in the Realignment...
    Thanks

    Hi,
    In the Realignment start screen, you can set the flag u201CActivate Application Logu201D. This will help you to see and analyze  the log.
    Please check if you can see the copy step.
    When you click u201CMaintain Entriesu201D , you will see the screen of u201COverview of Copy Tableu201D.
    Therein you should see the steps you have maintained.
    Check the Step Status . It should be u201CCope Step is ready to be performedu201D.
    The validity date (fourth column) should be either todays date or earlier date.
    Copy Validity Date:The validity date from which a copy step is taken into account during a copy run. Only copy steps  whose validity date is before the date of the copy run job are taken into account.
    Regards
    Datta Kadam

  • Some problem using in this function!!!

    Is it valid to write a function like this??
    CREATE OR REPLACE FUNCTION
    dept_dtls(DEPT_ID IN VARCHAR2)
    RETURN record is
    DEPT EMPLOYEE.DEPT_ID%TYPE;
    STATUS RECORD;
    BEGIN
    Select COUNT(DESIGNATION),
    into STATUS
    from EMPLOYEE
    where DEPT=DEPT_ID
    GROUP BY DESIGNATION;
    RETURN STATUS;
    END dept_dtls;

    There are many things that I don't understand here or probably Oracle even can't understand.
    RETURN record
    What is record? WHen yu are taking count(something), it would be a number so, status variable should hold number and so should be of number datatype. By the way, if you had used GROUP BY function, then there is every possibility that this select results in one or more number of records which fails the function with TOO_MANY_RECORDS exception.
    Cheers
    Sarma.

  • I have transefer function like (1/(s^2+s+​5)) and i have a square wave input , i want to use this transfer function with this input to see the output , how can i do that , with example please.

    i need to know also how to represent this transfer function in labview, try to send me example. answer me at my mail

    "st" wrote:
    > answer me at my mail
    give a valid e-mail first, and your name, we don't like to help anonymous
    people
    > try to send me example.
    how much do you pay ?
    > i have transefer function like (1/(s^2+s+5)) and i have a square wave
    > input , i want to use this transfer function with this input to see
    > the output , how can i do that
    First you have to know what you are doing, like an engineer : you have a
    Laplace, continuous time transfer function but LabView handles discrete
    signals only. Use matlab/simulink if you want to simulate continuous time
    systems easily...
    If you definitely want to use LabView, the first step is to discretize your
    continuous-time transfer function, i.e. decide a sampling rate and convert
    it to a "z transfor
    m". Then you can directly use the "IIR Filter.vi" as I
    said earlier.
    Philippe Guglielmetti - www.dynabits.com me at my mail

  • SAP XI - Using the substring function.

    Hi Experts,
    I am having trouble using the substring function in SAP+XI. I have to consider the value from characters 6 to 19 for a target field of 25 characters. Every time I ma using the standard substring function it is giving an error Array Out of Bounds Exception.
    Please tell me how to proceed.
    Thanks
    Aniruddha

    Hi,
    Above error wil come if the input string length is less than the substring length what you are trying to get..
    i.e length of the input string is less than 25 characters... do some validations or pass substring as 6 and 0 ..
    HTH
    Rajesh

Maybe you are looking for

  • Unable to load master data to cube

    Hi, I have one master data 0PART which is referenced by 0Activity Type master data. I have added 0PART chara into one infocube. and wrote abap code in update rule as below: data:    begin of i_acttype occurs 0,                 0PART like /BI0/PACTTYP

  • TS2755 why wont my iphone let me delete messages? my phone freezes and then all the messages i deleted reappear.

    i have tried deleting my messages 3 times and everytime they go away but m phone freezes so i turn it off. But when  i turn it back on all the messages i have deleted reappear. Also i have not gotten several texts that people have sent me.

  • Problem with Text

    Hi. I'm helping my friend edit some text in a flash file. The only problem is that we can't locate the text anywhere on the stage, timeline, or anything. When we publish the flash file, the text is showing. Is it hidden within the file or something w

  • Export for Web - not working

    I tried this once and it worked fine, even with other programs running. Now with only QuickTime running the export keeps canceling out (export unexpectedly failed). I tried rebooting and get the same thing. Any ideas?

  • Autoscroll

    Hi, Can anybody help me in doing autoscroll in swing application. I am using the follwing code but it does not work perfectly. Sometimes it does not scroll up or down properly. <code>                if(!scrollPane.getBounds().contains(focusedPanel.ge