How do I let user enter a primary key value on a form

I'm creating my first APEX application. I have a simple table called HOSTS with 2 columns HOSTNAME and IP_ADDRESS. HOSTNAME is the primary key for the table. HOSTNAME is a perfectly acceptable primary key and I don’t wish to create an additional column to be populated by a sequence.
What are my options for creating a form on the table without using "Existing trigger", "Custom PL/SQL function" or "Existing Sequence" to populate the primary key column, i.e. HOSTNAME, so that the user can enter a value for the primary key?
Any assistance greatly appreciated.
Gavin

The debate about natural keys versus surrogate keys
will no doubt continue with advocates for both sides.
However there is also a difference between
'making your life easier' for APEX development and
'making your life more difficult' by having to
analyse, implement and deploy a surrogate key only
approach to an existing database which employs both
natural keys and surrogate keys.
hould we be forced to change the database design
because a development tool does not cater for natural
primary keys?The application development product is TRYING to save you from shooting yourself in the foot. The idea is to separate the primary key from being accessed by the user or ANY carbon based unit.. The key is mainly used by the system to join and lookup data rows, not for people to change whenever they decide that the key is WRONG.
Think about this, if you use Last Name as a key in your system (a bad idea to begin with since this is NOT a unique id when you have two Smiths). When a person needs to change this because Jimmy Smith is NOT the only Smith working for Acme Toys, you have to cascade that change through all the child tables related to the main person table.
If instead you use a system generated key, no change will be required since the key has NO relation to the data other than it represents a pointer to that row of data.
Works for me, since I do not want to write all the supporting code when APEX builds it for you...
Thank you,
Tony Miller
UTMB/EHN

Similar Messages

  • How do I let user enter a number?

    how do I let user enter a number?Any method or proccess.Plz help.

    On the command line you can use:
    BufferedReader in = new BufferedReader(new InputStreadReader(System.in));
    String line = in.readLine(); // characters so far
    int number = Integer.parseInt(line);Notify that if the user enters something different from a number an exception in thrown. In that case you should possibly ask him again.
    In swing applications of applets you would do it different.
    regards
    Sven
    regards
    Sven

  • How to differentiate whether user entered '0' or no value in the parameter?

    I need some clarification.On my selection screen I have 4 parameters( P_QTYLL,P_QTYUL,P_AMTLL,P_AMTUL). I have to check the values entered by the user in those fields and I have to display the user entered values in the next screen.My problem is if the user enters '0'(in any of the above fields) means '0' has to displayed in the next screen.But if he enters nothing means then nothing has to be displayed in the next screen.My problem is I am checking for '0', against the values(initial,'',space,0) for user entered value.But I am unable to differentiate the '0' and nothing(no value) even though I checked against the values(initial,'',space,'0').All the 4 conditions are treating both the '0' and 'novalue' the same.How to differentiate whether user entered '0' or entered nothing(no value).
    for example below is my code
    IF P_QTYLL EQ 0.
    P_QTY_LL = P_QTYLL.
    ENDIF.
    IF P_QTYUL EQ 0.
    P_QTY_UL = P_QTYUL.
    ENDIF.
    IF P_AMTLL EQ 0.
    P_AMTLL_S = 0.
    ENDIF.
    IF P_AMTUL EQ 0.
    P_AMTUL_S = 0.
    ENDIF.
    IF P_QTYLL EQ ''.
    P_QTY_LL = ' '.
    ENDIF.
    IF P_QTYUL EQ ' '.
    P_QTY_UL = ' '.
    ENDIF.
    IF P_AMTLL EQ ' '.
    P_AMTLL_S = ' '.
    ENDIF.
    IF P_AMTUL EQ ' '.
    P_AMTUL_S = ' '.
    ENDIF.
    LIKE THE ABOVE I checked against the values space,initial.But using those I am not getting any difference for no value and '0' .All the four values(space,initial,'0','') are treating both the '0' and no value in the same way.
    Thanks,
    Balaji

    hi,
    you said your teamlead doesn't want the type to be changed to 'C'.so try adding one dummy variable  of type c and pass your parameters value to this dummy variable and check  dummy variable for value '0'.
    eg:
    Data DUMMY(11) type c.
    DUMMY = P_QTYLL.
    IF DUMMY EQ 0.
    P_QTY_LL = P_QTYLL.
    ENDIF.
    DUMMY = P_QTYUL
    IF DUMMY EQ 0.
    P_QTY_UL = P_QTYUL.
    ENDIF.
    i think this will help you 2 some extend.

  • How to get the auto increment integer primary key value of a new record

    I have a DB table that has a auto increment integer primary key, if I insert a new record into it by SQL statement "INSERT INTO...", how can I get the integer primary key value of that newly created record?

    Well maybe someone knows a better method, but one workaround would be to add a dummy field to your table. When a new record is inserted this dummy field will be null. Then you can select your record with SELECT keyField FROM yourTable WHERE dummyField IS NULL. Once you've got the key number, you then update the record with a non-null value in the dummyField. Bit of a bodge, but it should work...
    Another alternative is, instead of using an Autonumbered key field, you could assign your own number by getting the MAX value of the existing keys (with SELECT MAX(keyField) FROM yourTable) and using that number + 1 for your new key. Might be a problem if you have lots of records and frequent deletions though.

  • How to populate field on page with Primary Key value from previous page

    I am trying to create a patient tracking system for a group of doctors. There is an add patient form based on the Patient table (which has Patient_Id as its primary key) which branches to a pre-operative assessment form. I would like to populate the pre-op assessment Patient_Id field with the Patient_Id generated by the Add Patient page during processing, which comes from the Patient_seq sequence. How can I do this? I have tried using a computation on the Pre-Op Assessment form, but no matter what I put in, the field remains blank.

    Hi,
    If I understand you correctly, once patient record is created you branching to next page (pre-operative assessment form). First create a static hidden item in patient form *:PX_PATIENT_ID_COPY*.
    Create an On submit after computation and validation process in patient form to get the inserted patient_id from patient table. Here is the code -
    SELECT patient_id into :PX_PATIENT_ID_COPY from patient_table where rownum=1
    order by patient_id descI would not use the sequence to get the current value because if the inserted record been deleted from your patient table, sequence current value would not be valid to find that record in patient table.
    Basically when the record been inserted, the process get the value and put into the hidden item.
    Pass the value from the hidden item to the next page by setting them in page branch. Under the Action section in the page branch, Set this items field type - *:PX_PATIENT_ID* (next page item for patient_id). Type *&PX_PATIENT_ID_COPY.* in the with these values field. Make sure you include dot(.) after *&PX_PATIENT_ID_COPY*.
    Give it a try now. Hope it would helps.
    Regards,
    Tajuddin
    Blog: http://aspblog.whitepagesbd.com
    web: http://tajuddin.whitepagesbd.com

  • How to generate the primary key item automatically in form region?.

    Hi,
    The primary key item is generated automatically in report region.I already give the pl/sql function for generating of primary key.but I want to generate the primary key value automatically in form region only?.how to do this?.Pls help me..
    Thanks and Regards.

    One of the guidelines when selecting column for a primary key is:
    Choose a column whose data values are never changed. A primary key value is only used to identify a row in the table, and its data should never be used for any other purpose. Therefore, primary key values should rarely or never be changed.
    Cheers!

  • How to get the user entered data?

    Hi all,
    I have created an HTMLB DynPage component.
    In That i have created my input screen with textboxes using response.write method.
    i have added one onConfirm event on which the data whould validate.
    so onConfirm method im trying to get the data with request.getParameter method which returns null...
    how to do...how to get the user entered data to do my validations...can anyone plz advice.
    Thanks,
    Viswes

    Hi
    inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
    to create portal input field (ie HTMLB), you should do something like
    this in the doProcessBeforeOutput member function
    InputField field1 = new InputField("Id1");
    field1.setSize(8); // 8 characters
    this.getForm().addComponent(field1);
    and in doProcessAfterInput member function
    InputField field1 =
    (InputField) this.getComponentByName("Id1");
    you can then manipulate the content of the field.
    Hope this help,
    Guillaume

  • How do a let users add a link in a submission, similar to attaching a file?

    how do a let users add a link in a submission, similar to attaching a file?
    I want teachers who want to list a link to a website, be able to insert a link. how?

    would it be a good idea to send a shortcut to desktop from explorer, and then upload that as a file attachment? will that work for most people?

  • Apex Form - how to enter primary key value manually?

    Hi
    Whenever I am creating Apex form using wizard, it asks me to specify trigger/sequence/pl/sql function for populating primary key value.
    However, if I want to specify primary key myself (ie. not auto generated number), how I can specify that?
    Thanx

    Hello,
    By Yourself you mean : by hand or by a pl/sql?
    If you say by trigger, the system doesn't care about what number is send. So you can give it "manually"
    May I ask what is the reason of that?
    Cheers,
    Arnaud

  • How to Create process of Type : Get Next or Previous Primary Key Value

    Hi,
    Can anybody give the steps how to create the page process for type Get Next or Previous Primary Key Value in oracle Express database
    Ramesh j c.

    Hi Justin,
    In oracle 10g XE , we have sample application v2.0
    1. Do you have any Document to create step by step the sample application v2.0 and Is it possible to create all the pages of this sample application v2.0 b by wizard. To recreate or create the demo app, start from the home area,
    next go to application builder,
    then click the create button,
    next choose "demonstration application"
    and then you can choose "Run | Edit | Re-install" the "Sample Application" along with a few other apps.
    2. When we install this sample application v2.0 , which is the sql script is executed or how it is installed. If you want the sample application you can export it after you create it if you want the SQL associated with it.
    3. Whenever the sample application v2.0 is installed, how the encrypted pass word is created for the user demo and admin. This is setup with the application install. I don't believe it is encrypted either. If your wanting SSL there are some threads on here that talk about encrypting content.
    Justin thanks for to create process Get Next or Previous Primary Key Value

  • How to set two attributes as  a primary key in database ?

    how to set two attributes as a primary key?
    Take COffeesbreak as an example ,
    let's suppose that there are cof_name ,sup_id,price and so on;
    the same cof_name may be suplied by more sup_ids,
    and one sup_id may suply more cof_names.
    so the Primary key should be set the cof_name and sup_id ,
    how to set ?
    (of course that i konw if I set a cof_id,the problem will be easy work out
    but now there are those like above)
    I set that as following:
    create table coffees (cof_name VARCHAR(32) PRIMARY KEY,sup_id INTEGER, PRIMARY KEY,PRICE INTEGER )
    THE database print error :cant add more primary keys!
    thanks in advance

    You can only use the PRIMARY KEY declaration on a column if it is the only Primary Key column.
    Use the PRIMARY KEY constraint statement instead.
    create table coffees (
      cof_name VARCHAR(32),
      sup_id INTEGER,  
      PRICE INTEGER,
      PRIMARY KEY ( cof_name ,sup_id )
    )Dave

  • How to display the Primary key field in Application Form.

    IDFINALNO , USERNAME
    (No view) , RockQin
    I developed one new application form which is including the "Edit" item in every record.
    But I can not find the data that is Primary key field . So how to config the property to display that data.
    Thanks a lot!

    One of the guidelines when selecting column for a primary key is:
    Choose a column whose data values are never changed. A primary key value is only used to identify a row in the table, and its data should never be used for any other purpose. Therefore, primary key values should rarely or never be changed.
    Cheers!

  • How to update a parent (primary key) value?

    hello...can anybody give me a hint that how to update a primary key value in master table through forms as well as update all child records keeping in mind that "ALTER TABLE" and constraint disabling is not permitted by DBA. Parent Records are being displayed in form in a database block while child records are not displayed on form.

    See
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:914629004506
    and
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html
    cheers

  • Another user changed the primary key

    am using jdev 11.1.1.5.0-adfbc
    after each and every insert while saving the record
    error throws like this >>>Another user changed the primary key
    what should i do to avoid this?
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BC4JConfig version="11.1" xmlns="http://xmlns.oracle.com/bc4j/configuration">
       <AppModuleConfigBag ApplicationName="com.rits.glm.model.servicesAM.generalLedgerAM">
          <AppModuleConfig DeployPlatform="LOCAL" JDBCName="goodwell" jbo.default.country="IN" jbo.project="com.rits.glm.GeneralLedger" name="generalLedgerAMLocal" ApplicationName="com.rits.glm.model.servicesAM.generalLedgerAM">
             <Database jbo.locking.mode="optimistic"/>
             <Security AppModuleJndiName="com.rits.glm.model.servicesAM.generalLedgerAM"/>
          </AppModuleConfig>
          <AppModuleConfig DeployPlatform="LOCAL" JDBCName="goodwell" jbo.default.country="IN" jbo.project="com.rits.glm.GeneralLedger" name="generalLedgerAMShared" ApplicationName="com.rits.glm.model.servicesAM.generalLedgerAM">
             <AM-Pooling jbo.ampool.dynamicjdbccredentials="false" jbo.ampool.isuseexclusive="false" jbo.ampool.maxpoolsize="1" jbo.ampool.resetnontransactionalstate="false"/>
               <Database jbo.locking.mode="optimistic"/>
             <Security AppModuleJndiName="com.rits.glm.model.servicesAM.generalLedgerAM"/>
          </AppModuleConfig>
       </AppModuleConfigBag>
    </BC4JConfig>

    some suggestions
    JBO-25014: Another user has changed...
    http://adfhowto.blogspot.com/2010/12/troubleshooting-another-user-has.html
    Another user has changed the row with Primary key

  • How can we export the Primary key values (along with other data) from an Advantage database?

    One of our customers is moving from our application (which uses Advantage Database Server) to another application (which uses other database technology). They have asked us to help export their data, so that they can migrate it to another database system. So far, we have used the Advantage Data Architect (ARC32) "Export Table Structures as Code" functionality to generate SQL. We used the "Include existing data" option. The SQL contains the necessary code to recreate the tables and indexes. The customer's IT staff will alter the SQL statements as necessary for their new system.
    However, there is an issue with the Primary Keys in these table. The resulting INSERT statements use AutoInc as the type for the Primary Key in each Table. These INSERT statements contains "DEFAULT" for the value of each of these AutoInc fields. The customer would like to output an integer value for each of these Primary Key values in order to maintain referential integrity in their new system.
    So far, I have not found any feature of ARC32 that allows us to export the Primary Key values. We had been using an older version of ARC32, since our application does not use the latest version of ADS. I did download the latest version of ARC32 (11.10), but it does not appear to include any new functionality that would facilitate doing this sort of export.
    Can somebody tell me if there is such a feature in ARC32?
    Or, is there is another Advantage tool to facilitate what we are trying to accomplish?
    If there are no Advantage tools to provide such functionality, what else would you suggest?

    George,
      It sounds like the approach you are using is the correct one. This seems to be the cleanest solution to me especially since the customer is able to modify the generated SQL statements for their new system.
      In order to preserve the AutoInc values I would recommend altering the table and changing the field datatype from AutoInc to Integer. Then export the table as code which will export the actual values. After the tables have been created on the new system they can change the field datatype back to an AutoInc type if necessary.
    Regards,
    Chris Franz

Maybe you are looking for

  • How do I bookmark all my currently open tabs in one click in Firefox 4?

    I used to be able to bookmark all my currently opened tabs with a click of one button under the Bookmarks menu, but that option is now gone. Is it gone forever or I just don't see it?

  • Keynote Remote Doesn't work with iPhone, iPad

    Hi, I have the latest versions of Keynote on my iPhone 5S, iPad 4 and MacBook Pro 13" with Retina Display. All three devices on the same WiFi network. Using WiFi I was able to remotely control/play the presetatnion between iPhone 5S and MacBook. Howe

  • Need to read all files in a foldert to a list BUT HOW !

    Hi guys Thanks for all the help I have been getting here. I just wish I could help someone else, but that day will come. Well I hope so. I would like to know the best way (no the easiest way) of reading the entire file in a folder into a list. Can so

  • Oracle Rdb JDBC: Insufficient global memory

    Environment: IA64 OpenVMS 8.3 Java RTE version 1.5 Oracle RDB version 7.2-2 SQL/services version 7.3 JDBC server for RDB version 7.3 JDBC-Thin driver version 7.3 The problem: we have a JDBC dispatcher with 20 executor processes. We have a client appl

  • Consignment Deliveries: Handling Unit Changes to Non Assigned HU

    Hell Experts, We are having an issue with the consigment deliveries. After doing the PGI, the handlling unit assignment changes to Non Assigned Handlling Unit. Situation Before PGI: VEKP-VBOBJ = 01 VEKP-VBOBLKEY = <Delivery Number> After PGI: (Moveme