How to Validate a Portal Form field from the database

I created a Portal Form based on a procedure, which requires three parameters. One of the parameters is Item Number. I need to check if the Item Number exists in database. I am trying to use pl/sql button event handler, where I try to use the select count(*) statement to verify. However, I don't know how to reference the form field in the where clause. Please advise. Or is it possible to achieve this by creating a javascript? If you go to 'Shared Component' provider and click on javascript, you will see some system validation scripts, which you can call in the form level validation. My doubts with javascipt is how I can talk to database in the script? Any input is appreciated.

Hi,
You cannot access the DB from the script. If you want to access the values of a field you should use session variables. Here is a sample to access the values of a form field.
declare
ticket_no varchar2(20);
flight_no varchar2(20);
blk varchar2(30) := 'DEFAULT';
begin
ticket_no := p_session.get_value_as_varchar2(
p_block_name => blk,
p_attribute_name => 'A_TICKET_NO');
flight_no := p_session.get_value_as_varchar2(
p_block_name => blk,
p_attribute_name => 'A_FLIGHT_NO');
end;
Thanks,
Sharmila

Similar Messages

  • Need to know how to iterate a list of field from the req xml in page servic

    Hi All,
    Please help me out with java code in which i am able to iterate a list of field coming in the request xml to my page service class under read(Pageheader header) method of mine queryPagemaintenace class.
    package com.splwg.cm.domain.pageService;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.environ.FieldDefinition;
    import com.splwg.shared.environ.ListDefinition;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER, service = CMUSER,
    * body = @DataElement (contents = { @ListField (name = USER_GROUP_LIST)
    * , @ListDataField (name = USR_GRP_ID)
    * , @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = USER_ID)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)}),
    * actions = { "add"
    * ,"read"
    * , "delete"
    * , "change"},
    * header = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * headerFields = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = USR_GRP_ID)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100, includeLCopybook = false,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))},modules = {})
    public class CMUSER extends CMUSER_Gen {
    public static final Logger logger = LoggerFactory.getLogger(CMUSER.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected DataElement read(PageHeader header) throws ApplicationError{
    I want to know how can i iterate this USER_GROUP_LIST in my read method and get the USR_GRP_ID field data from it.
    A Prompt reply from your end will help me to resolve this issue

    Guru Sir,
    i tried to override the add() method of the framework in that i was able to iterate the field from the list. But now the i am facing there is that i am not able to send back the response to the external system in XML format. I am getting a blank response in my SOAP UI Tool while testing here is the code:
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER4, service = CMUSER4,
    * body = @DataElement (contents = { @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @ListDataField (name = USR_GRP_ID)
    * , @ListField (name = USER_GROUP_LIST)}),
    * actions = { "add"
    * , "delete"
    * , "change"
    * , "read"},
    * header = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * headerFields = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))}, modules = {})
    public class CMUSER4 extends CMUSER4_Gen {
         public static final Logger logger = LoggerFactory.getLogger(CMUSER4.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected PageHeader add(DataElement item) throws ApplicationError{
              BusinessObjectInstance boInstance = BusinessObjectInstance.create("CM-USER");
              String USR_GRP_ID = null;
              try{
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.USER_ID));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.FIRST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.LAST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.EMAILID));
              // logger.info("Data coming from the Service into the Application is :"+getInputHeader().getString(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID));
              // Iterator it = STRUCTURE.
              ItemList sourceList = item.getList(STRUCTURE.list_USER_GROUP_LIST.name);
              List userGrpID = new ArrayList();
              logger.info("The Size of the User Group List here is :"+sourceList.size());
              Iterator iter;
              if ((sourceList != null) &&
              (sourceList.size() > 0)) {
              for (iter = sourceList.iterator(); iter.hasNext(); ) {
              DataElement myItem = (DataElement)iter.next();
              USR_GRP_ID = myItem.get(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID);
              logger.info("The User Group Id coming in the List here is :"+USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.PASSWORD));
              boInstance.set("user", item.get(STRUCTURE.USER_ID));
              boInstance.set("firstName", item.get(STRUCTURE.FIRST_NAME));
              boInstance.set("lastName", item.get(STRUCTURE.LAST_NAME));
              boInstance.set("emailAddress", item.get(STRUCTURE.EMAILID));
              // COTSInstanceList userGrpList = boInstance.getList("userGroupUser");
              // COTSInstanceListNode userGroupList = userGrpList.newChild();
              COTSInstanceListNode userGroupList = boInstance.getList("userGroupUser").newChild();
              userGroupList.set("userGroup", USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+userGroupList.toString());
              /*boInstance.set
              boInstance.set("userGroup", getInputHeader().getString(STRUCTURE.HEADER.USR_GRP_ID));*/
              // UserTypeLookup.constants.TEMPLATE_USER
              //if(element.get(STRUCTURE.USER_TYPE_FLG))
              //boInstance.set("user", element.get(STRUCTURE.));
              boInstance.set("dashboardWidth","200");
              boInstance.set("homeNavigationOption","CI0000000574");
              boInstance.set("language","ENG");
              boInstance.set("toDoEntriesAge1", new BigDecimal(50));
              boInstance.set("toDoEntriesAge2",new BigDecimal(100));
              boInstance.set("displayProfileCode", "NORTHAM");
              String expirationDate = "2100-12-31";
              String[] array = expirationDate.split("-");
              userGroupList.set("expirationDate",new Date(Integer
                             .parseInt(array[0]), Integer
                             .parseInt(array[1]), Integer
                             .parseInt(array[2])));
              //boInstance.set("userGroupUser", userGroupList);
              COTSInstanceListNode roleUserList = boInstance.getList("roleUser").newChild();
              roleUserList.set("toDoRole","F1_DFLT");
              COTSInstanceListNode dataAccessList = boInstance.getList("dataAccessUser").newChild();
              dataAccessList.set("dataAccessRole","***");
              String expiryDate = "2100-01-01";
              String[] array1 = expiryDate.split("-");
              dataAccessList.set("expireDate",new Date(Integer
                             .parseInt(array1[0]), Integer
                             .parseInt(array1[1]), Integer
                             .parseInt(array1[2])));
              BusinessObjectDispatcher.execute(boInstance,
                             BusinessObjectActionLookup.constants.FAST_ADD);
              page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "User Added Successfully");
              page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              }catch(Exception e){
                   e.printStackTrace();
                   page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "Caught Exception in the ORMB System. Please reach out to the Admin"+e.getMessage());
                   page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              return page;
    If you can help me to find out what went wrong here while sending the response back it can close my issue.

  • How find print program and form name from the spool list

    Hi,
          I have a requirement to find print program and form name from the spool list.
    I got the list of programs and forms from TNAPR table, I also want to find out any custom program sending the form directly to the spool.
    Cheers
    Sam

    Hi
    Try TSP01-Suffix2
    Regards
    Raj

  • How to validate a select-option field on the selection- screen

    Hi,
       I need to validate a selection-option field in the selection-screen.
    Requirement is : i need to read each of customer number one by one and validateCan you please me in achieving this.
    Best Regards
    Mamatha.B

    hi,
    chk this sample code.
    SELECT-OPTIONS : s_kunnr for kna1-kunnr.
    AT SELECTION-SCREEN.
         if 'S_KUNNR-HIGH' = "condition
        "put your required validation here
         endif.
    rgds
    Anver
    Message was edited by:
            Anversha s

  • How do i store and fetch image from the Database(Access)

    i am facing one problem in inserting the image into the database.the steps i followed as
    1)i have created one database(access) as "Image" and into that one table as "Image" and field as "image"
    type of the field is ole object.
    2)i have inserted one image into the image field through "database.vi"
    3)now i am trying to get the image from the database by "Fetching Example.vi"
    4)it will succesfully retrieve the image from that field .
    5)but when i close the both programs and reopen those that time i am unable to get retrieve the image.
    Attachments:
    Add_to_Database.vi ‏78 KB
    Fetch_from_database.vi ‏67 KB

    I would like to suggest different approach for saving the images in the database.
    I was working on Medical Imaging Company. The way we save the images in real-time was by writing the name and path of the images to database.
    The images themselves where saved directly to disk.
    I don�t think that access is very good in taking care of GBytes of data.
    It happens some time that the database gets damage. If you have the images separately you can create fix procedure. (We had one).
    Good Lack,
    Amit Shachaf,

  • Notifying a forms client from the database

    I would like to notify a forms client of a certain things that happens in the database.
    I guess this could be done by having a timer polling a table at certain intervalls.
    I my case that solution is not good because I need a fast reaction (<2 sec) which would require the client to poll in a high frequency.
    Is there any way to do this?
    Could I somehow embedd a java client in the form window that the database could notify and that then notifies the form client or perhaps start a back ground process that could listen to events and the notify the client somehow.
    Any clues anyone?
    Carl Larsson

    Carl
    2 Seconds doesn't sound like a particularly excessive frequency for the polling method, but it would be best combined with DBMS_ALERT as suggested by Jiri rather than looking at a table. I have had an application live for the last two years using this method involving 14 clients polling at one second intervals and have had no performance implications. DBMS_ALERT.WAITONE has the ability to wait a specified time for a reply, but this should be set to zero, so control is returned immediately to the form and all waiting is handled by the timer.
    The Java method should in theory be more efficient if you have the knowledge to implement it (I don't !).

  • How to populate form fields from ODBC Database?

    Using LifeCycle ES2, i have created a form, to which through ODBC i have connected a database. Although in MS Query database picks up table relationships, including unique parent records of the table. However when input records from db tables in their respective position on the form, no db relation remains. What im trying to do is to make form populate all fileds based on change of unique parent record. Do i have to use XML schema for that [is there any generating software?] as im not familiar with XML. or are there any settings i have missed in LifeCycle? Because right now, altering any db fields in pdf forms do not affect any other db fields in the form. Please help!

    I think I am trying to do the same thing and I hope someone had done this before. I have a form that an employee will fill out for their travel expense reimbursement. On the top of the form, there is a drop-down-list that is alreay populated with a list of employees. The person who fills out the form will pick his/her name from the drop-down-list and the information will be populated for other fields such as employeeID, department and supervisor's name...
    The information that is supposed to be populated is in a database. How do I go about achieving this?
    Thanks in advance for any helps.

  • How to use an infopath form field in the designer workflow

    Hi,
    I need to send an email to a person field from Infopath form. Can i access it in the workflow. If not, is there a way i can send an email on form submission from within the infopath form.
    Please help. Thank you.

    Hi Prajk,
    There are three ways of achieving it, one i will say its pretty straightforward and covers the basic of Infopath Forms Development
    1)Populate Fields From Infopath Form at the time of Publishing.
    The moment you done with your form and to publish you click FIle>Publish>SharePoint Server >Enter the Url of Site> Then Click Next twice upto a point where wizard asks "The fields listed below will be available as SharePoint Columns" ,
    Click Add, select the placeholder in myfields for Person Field , expand the "person" group field and choose "AccountId", give the name to column(this will be SharePoint List Column Name) and for function select "first" and then
    click next and Finish.
    And use this field in Designer Workflow to send email.
    2)Second way is to write VSTA based C# code on click of your  Submit action on the form and upload and activate this form on form library via Central Admin.
    3)Now other way of doing this is via Event Recievers.
    Every infopath Form is an XmL File so on ItemAdded event you can extract its content and implement email sending c# code there:-
    http://www.bizsupportonline.net/infopath2007/how-to-use-sharepoint-event-handler-object-model-submit-data-infopath-form-sharepoint-list.htm
    Mark as Answer if helped!! To be or Not to Be..The question is this only......

  • How do I use a form field as the reply to address?

    I've created a form, and I'd like to use the person's email address (which they enter in a field), as the reply address, so that the recipient of the form, can just hit reply to, and it will go to the person's email address.
    Help!
    Thanks
    Chris

    Chris_Finlayson wrote:
    I've created a form, and I'd like to use the person's email address (which they enter in a field), as the reply address, so that the recipient of the form, can just hit reply to, and it will go to the person's email address.
    Help!
    Thanks
    Chris
    Hi Chris
    The first thing I have to ask is why?
    Most email clients automatically open the 'create new message' option when an email address is clicked on, (or reply to is selected) with the email address automatically inserted in the 'To' field.
    PZ

  • How to stop application folder form disappearing from the dock

    I'm on MAC OS 10.6.7 on my Macbook 7.1.  My applications folder disappeared from the dock.  I can drag a new copy from the Mac Hard Disk folder to the dock (to the right of the dashed line (my dock is at the bottom) and it appears with an Address book icon.  After 10 to 15 seconds, the icon disappears.
    Anyone know what is going on and how to fix this?

    Not sure why this is happening, but try this. This is the way I've done it. First, make an alias of the folder (File>make alias) and put it somwhere, like Documents. Then, copy drag it (Option-click) to the part of the dock below or to the side of the separator near the Trash icon. This will place an alias of the folder in the Dock. You must keep the first alias you made.
    You can also make one just for Utilities, the same way. The app folder will appear with an A and the Utilties folder will appear with an X.
    EDIT: It's been a while now, but I think I got rid of the default app folder because I didn't like the way it looked and functioned.
    You can also see I put an alias of my home folder there, as well.
    Might as well mention another customisation. Get Tinkertool (free) Go to Dock>Disable Dock Expose to get rid of the very annoying -- at least to me -- entire screen turning black when opening one of the Dock icon's options.
    http://www.bresink.com/osx/0TinkerTool/download.php5
    Message was edited by: WZZZ

  • Combining two form fields from the same document, into one form field?

    I have a field called "first name" and one called "last name".  How do I create a third field called "full name".  I want it to just combine the first two.  Any ideas?

    In the field's calculation tab (under Custom Calculation), enter:
    event.value = this.getField("first name").value + " " + this.getField("last name").value
    Message was edited by: try67
    Forgot to paste a part of the code...

  • Delete record from the form and from the database

    hi,
    i want delete record from the form and the database ,but the record is only delete from the from !!!
    this is my code :
    if //condition then
    delete_record;
    commit;
    end if ;
    Any solutions ??
    thnx

    You have unique key field(s) on the table you are trying to insert which actually restricts you from inserting the same value again.
    When you are deleting the record and issue commit there is a record to be inserted in the table which is a duplicate that's why you are getting this unique error.
    As oracle is not able to insert your commit fails and stops your deletion of record from table

  • How to pull in a 'Public Function' from the database.

    Hi,
    We're using OWB 11.1.0.7.
    I'm trying to import a public function into OWB from our database.
    When I go to the Global Explorer and right click on 'Functions' all I get are 'New' and 'Add/Remove Experts Here'.
    When I select 'Add/Remove Experts Here'. It just gives e an option to select the Public Project object.
    When I do, nothing happens.
    Selecting 'New' just wants me to create a function from scratch, which is not what I want.
    I just want to import a function into the 'Custom Functions' under 'Public Transformations' from my database.
    Anybody?

    Since function in your DB is specific to DB schema you need to import that function in OWB into module that is defined for that schema. After that you can copy/paste that function in Global Explorer custom functions.

  • How to compile a piece of code from the database

    I've created my own object navigator which is also able to view the code of a certain object. (HTML)
    I'm trying to create a function to compile this code again to the database.
    I've tried "execute immediate" but this has the downside that It can only parse 32kb of text and that every object I create in this manner will not compile correctly. ("success but with compilation errors")
    How can I compile my own objects?

    If your objects already exist in the database, try
    EXECUTE IMMEDIATE 'ALTER FUNCTION function_name COMPILE' ;
    Of course if you make changes, one of your options is to compile using SqlPlus (using a script).
    You could also create an external proc (Java or C) to compile the objects.
    I've created my own object navigator which is also able to view the code of a certain object. (HTML)
    I'm trying to create a function to compile this code again to the database.
    I've tried "execute immediate" but this has the downside that It can only parse 32kb of text and that every object I create in this manner will not compile correctly. ("success but with compilation errors")
    How can I compile my own objects?

  • Is there a sensible way to import form fields from an old pdf into a new pdf?

    I'm working with Acrobat X Pro on a Windows PC platform.  I've been working with a file that was originally created in CorelDraw X3, in landscape orientation. That document was then saved as a pdf and set up with many form fields (it's an order form). The document needed to be updated with minor changes made in the Corel file. I resaved as a pdf and now want to transfer the existing form fields from the old document into the newly revised one. I've tried copy/paste, but have to do small sections at a time because the program doesn't let me bring in all of the fields at the same time. I then tried Document > Replace page, which I've seen described in other forum posts; but when I do that, the entire set of fields comes in rotated at 90 degrees counterclockwise. I did read that if the original document was created in a different orientation, that could affect how the fields paste in, but that is not the case here. The original file, and all successive pdf files all have been the same orientation. I'm boggled and think that there has to be an easier way than copying fields, a section at a time, and resizing them all over again.
    This older post is pretty similar to what I am trying to do, but it seems I'm getting a different end result. Any suggestions?
    Create fillable form with changing source document

    I am using Acrobat Pro 10. I have the same problem and finally after numerous different attempts of solving based on all the suggestions, I resolved my problem by Printing to PDF via the print dialog in Word. When I pasted the fields that were previously rotating onto the new "printed" PDf, the fields retained their orientation as desired.
    To clarify, I am using Word 2007, Acrobat Pro 10, the document is landscape, both the original (with fields) PDF and all attempted new PDF's were of the diemnsions 11 x 8.5. The only noticeable difference in the PDF properties for the PDF's were Tagged PDF and Fast Web View. The original PDF (with fields) was No in both cases and all attempts other than the Print to PDF were Yes, meaning that the Print to PDF was No. I am not sure if this made the Print to PDF work or not as I have already spent too much time trying to resolves this issue. Hope this helps.

Maybe you are looking for

  • CL_WD_CUSTOM_EVENT

    Hi, When sorting a table in WD, I found a post here in SDN with:   l_col_name = wdevent->get_string( 'COLUMN' ).   l_sort_direction = wdevent->get_string( 'DIRECTION' ). It works perfect for me, but I need to know where the 'COLUMN' and the 'DIRECTIO

  • Switched from vista to W7 and can't locate my audiobook files in iTunes. help

    My Vista os crashed, and I'm now using Windows 7 on the same desktop computer. I am not a teenager, considerably older!, and thus technology is not intuitive. I had backed up my files before the crash, and had music, but mostly audiobooks in my iTune

  • Drop shadow on video through actionscript

    Hey guys, Has anyone put a drop shadow on a video object through action script? I have a video that is loaded through action script that also has an alpha channel, I want to be able to add filters to it like a drop shadow. Thanks for your help.

  • Using other applications (specifically iClicker) with keynote

    I am trying to use iClicker in my keynote presentation. I am able to see the iClicker floating bar and graph on my presenter's view, but I can not get the floating bar to appear on the projected/presentation view. I have selected the appropriate opti

  • VISTA POR CUENTA ASOCIADA

    La cuestión es que nos acaban de actualizar la versión de SAP. ANTES, cuando entraba al saldo del Interlocutor Comercial, directamente veía el saldo distribuido en cuentas asociadas. AHORA, al darle a visualizar saldo, sale directamente el libro mayo