Query only insterting if three fields entered

Hi all
For some reason when executing this query there have to be values in the sectorid, ranking and department fields otherwise cf throws an error. As these fields are optional (and the db fields are allowed to be null) how can I make the query work if they are not filled out? Thanks
<cfelse>
<!--- ADD COMPANY QUERY --->
<CFQUERY name="addcompany" datasource="sales">
INSERT INTO COMPANY (COMPANY, SECTORID, RANKING, DEPARTMENT, FIRSTNAME, POS, PHONE, EMAIL, MOBILE, ADDRESS, city, dept, COMMENTS, DTLEAVE, MEETINGTIME, state, UPDATED)
VALUES ('#Trim(FORM.COMPANY)#', #Trim(FORM.SECTORID)#, #Trim(FORM.RANKING)#, 
#Trim(FORM.DEPARTMENT)#, '#Trim(FORM.FIRSTNAME)#', '#Trim(FORM.POS)#', '#Trim
(FORM.PHONE)#', '#Trim(FORM.EMAIL)#', '#Trim(FORM.MOBILE)#', '#Trim(FORM.ADDRESS)
#', '#Trim(FORM.city)#', '#Trim(FORM.dept)#', '#Trim(FORM.COMMENTS)#','#Trim
(FORM.DTLEAVE)#', '#Trim(FORM.MEETINGTIME)#', '#Trim(FORM.state)#', '#dateFormat
(now(), 'mmm dd, yyyy')#')
</CFQUERY>
<CFLOCATION URL="member_welcome.cfm">
</cfif>
</cfif>

Thanks all it works great now!!
<cfset isCOMPANYNull = iif(len(trim(form.COMPANY)) EQ 0, true, false)>
<cfset isSECTORIDNull   = iif(len(trim(form.SECTORID)) EQ 0, true, false)>
<cfset isRANKINGNull = iif(len(trim(form.RANKING)) EQ 0, true, false)>
<cfset isDEPARTMENTNull = iif(len(trim(form.DEPARTMENT)) EQ 0, true, false)>
<cfset isFIRSTNAMENull = iif(len(trim(form.FIRSTNAME)) EQ 0, true, false)>
<cfset isPOSNull = iif(len(trim(form.POS)) EQ 0, true, false)>
<cfset isPHONENull = iif(len(trim(form.PHONE)) EQ 0, true, false)>
<cfset isEMAILNull = iif(len(trim(form.EMAIL)) EQ 0, true, false)>
<cfset isMOBILENull = iif(len(trim(form.MOBILE)) EQ 0, true, false)>
<cfset isADDRESSNull = iif(len(trim(form.ADDRESS)) EQ 0, true, false)>
<cfset isCITYNull = iif(len(trim(form.CITY)) EQ 0, true, false)>
<cfset isDEPTNull = iif(len(trim(form.DEPT)) EQ 0, true, false)>
<cfset isCOMMENTSNull = iif(len(trim(form.COMMENTS)) EQ 0, true, false)>
<cfset isDTLEAVENull = iif(len(trim(form.DTLEAVE)) EQ 0, true, false)>
<cfset isMEETINGTIMENull = iif(len(trim(form.MEETINGTIME)) EQ 0, true, false)>
<cfset isSTATENull = iif(len(trim(form.STATE)) EQ 0, true, false)>
<!--- ADD COMPANY QUERY --->
<CFQUERY name="addcompany" datasource="sales">
INSERT INTO COMPANY(
COMPANY,
SECTORID,
RANKING,
DEPARTMENT,
FIRSTNAME,
POS,
PHONE,
EMAIL,
MOBILE,
ADDRESS,
CITY,
DEPT,
COMMENTS,
DTLEAVE,
MEETINGTIME,
STATE,
UPDATED
VALUES (
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.COMPANY)#" null="#isCOMPANYNull#" />,
<cfqueryparam cfsqltype="cf_sql_integer" value="#trim(form.SECTORID)#" null="#isSECTORIDNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.RANKING)#" null="#isRANKINGNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.DEPARTMENT)#" null="#isDEPARTMENTNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.FIRSTNAME)#" null="#isFIRSTNAMENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.POS)#" null="#isPOSNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.PHONE)#" null="#isPHONENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.EMAIL)#" null="#isEMAILNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.MOBILE)#" null="#isMOBILENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.ADDRESS)#" null="#isADDRESSNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.CITY)#" null="#isCITYNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.DEPT)#" null="#isDEPTNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.COMMENTS)#" null="#isCOMMENTSNull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.DTLEAVE)#" null="#isDTLEAVENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.MEETINGTIME)#" null="#isMEETINGTIMENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.STATE)#" null="#isSTATENull#" />,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(form.UPDATED)#" null="#isUPDATEDNull#" />
</CFQUERY>

Similar Messages

  • Update a single column in query only form

    Forms 9i, database 10g
    I am migrating the form from 6i to 9i. I have a form that is query only except for one field that can be updated. The main block1, based on a view, includes most of the person's personal data, none of which is updateable.. Another block2, based on a table, includes the 3 not-null colums that cannot be updated, and a remarks field, which can be updated. The block2 properties are set YES for insert, update, delete. The three non-updatable columns have properties set to NO for I,U and D, but the remarks column has I,U and D properties set to YES. When I enter data into the remarks field and press the Save on the Forms icon bar, I get error FRM-40508:unable to insert record and the ORA-00001:unique constraint. I don't should not be able insert and I don't want to, I just want to update one column.
    What am I not setting correctly in 9i? The same triggers and code works in 6i.
    Any suggestions are greatly appreciated.
    Vija

    No, there are no on-update triggers, but there are Post-Qry. I did run it in debug mode, but there is no good place to put a break point, since retrieval of the data works fine. Should I have key-commit trigger on the block to do the update?
    Vija

  • How to display LOV on web in ENTER-QUERY mode with form or block query only.

    Hello all
    How can I display lov automatic on the web in from enter-query
    mode in form or block query only mode.
    thankx

    If I understand correctly your explanation, your called form
    fails to activate the LOV in enter-query mode when it is deployed
    and test on the browser.
    So lets proceeed like this, to make it work in all environments,
    let us programetically activate the LOV.
    HOW?
    In the called form, write in the WHEN-NEW-ITEM-INSTANCE TRIGGER
    at block level (if have more than one LOV)
    IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
    IF get_item_property(:system.cursor_item,lov_name) IN ('YOUR
    LOV1', 'LOV2' etc) THEN
    IF SHOW_LOV(get_item_property(:system.cursor_item,lov_name))
    THEN
    NULL;
    END IF;
    END IF;
    END IF;
    The above code maybe tweak to suite your need and condition.
    This way, we explicitly make the LOV appear in ENTER-QUERY mode
    whenever the user clicks on an item with an attached LOV.
    Hope this helps.
    Mohammed R.Qurashi

  • Form with only 1 text field + ENTER: Error 404

    I have several JSP pages with forms to enter/edit data. As long as I use the mouse to click the submit buttons, I get no errors. If the form has more than 1 text field to enter, i can also edit one of these text fields and press the ENTER/RETURN key which has the same effect as the submit button clicked with the mouse. But if a form just has 1 text field, I get the following error when I press the ENTER/RETURN key (instead of clikcing the submit button with the mouse):
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    This is the same case on all JSP pages that only has 1 text field: they work when using the mouse by pressing the submit button but fail when using the ENTER/RETURN key.
    Is this a known bug? Is there a workaround for this?

    I believe that text inputs can have their own action
    attribute, so providing the same value there as in
    the form may help (though by default it should defer
    to the form's action).
    So try something like:
    <form action="x.jsp">
    <input type="text" name="..." action="x.jsp"/>
    </form>
    That doesn't help. The addresss bar is also always the same as the jsp pages are displayed in a html frame.

  • FRM-40208: Form running in query-only mode. Cannot change database fields.

    Hi,
    I am using forms 6i where it is calling a form from a menu in query like call_form(,query_only). Now an error is occurring on call of that form ‘FRM-40208: Form running in query-only mode. Cannot change database fields.’ Though this is been handled to give a certain message from on_error message from a package from library.
    Now the issue is that the error keeps on popping even after the ok button is pressed. There are number of records from the table. How can we handle the error. Any suggestion would be really appreciated!!!
    Regards,
    Rajesh

    thanks Gred but i have resolved the issue. it seems that each row was going into query_only mode (program written such a way). therefore the error was showing even after the OK button. handled the issue from ON_ERROR trigger. anyway thanks for your time Gred!

  • How to make a "SSWA JSP Function"  as query Only in Oracle 11i or R12

    Please someone help me in making a SSWA JSP Page as read only..
    For "forms" we use a parameter QUERY_ONLY="YES",what is the procedure for making a JSP as read only?

    All the enterable fields of an OA Framework Page can be made Read Only via personalization. Also you can disable/hide the transaction buttons. This way the page would become query only.

  • Enabling item on a query-only form

    Hi,
    I call a custom 6i form in query-only mode. However, now I need to enable one item on the first window for search purposes. I tried using SET_ITEM_PROPERTY,(ITEM_NAME,'Insert Allowed','TRUE') but it doesn't work. How do I achieve that functionality?
    Thanks.

    Hi,
    Thanks for the reply. I tried to set the property 'enabled' of the item to true so that I might be able to enter or update data into it.
    I am trying to change the form status from query only = YES and disable the blocks associated with it.

  • Called form in query only mode shows messages....

    Hi All,
    I am calling a form (say B ) in query only mode from a main form (say A) . When i query the called form B , i get 5-6 alerts (which has to be acknowledged by the user) and messages of the same error type saying :
    "FRM-40208 : Form running in query only mode . Cannot change database fields. "
    I have a 100 forms to be called from the main form A. So, I prefer not to change anything in the called forms . I tried to set message_level in the form A and code the on-error / on-message triggers to avoid the messages being shown, but nothing is working . Is there anything I can do in Form A i.e the main form ???
    Thanking you in advance.

    Since the error messages are being generated by form B, it is unlikely you will be able to fix form B problem using form A. Unfortunately, you may have to fix each of the 100 called forms.

  • Query only form problems

    I have a data block linked to a parent table in a parent/child relationship. The parent table's query key is made up of 2 data items. When the form is executed I want the users to enter values in these 2 data items and then press a button that has a trigger to execute the query. How can this be done and what properties should be set on the data block and items in this data block? Also, this form is a query only type form, no updating is to be premitted to the database.

    1. Consider to build a control block with these two items in the block.
    2. Create a LOV which will return the two items from a record group to the items in the control block.
    3. Passing the control block items' value for your query.
    Good luck.
    Jimmy

  • How to add three fields in Sales order item level and supress/hide many

    Hi Gurus,
    My client requirement is :
    1. Three fields to be added at Sales order Item level and they should flow till billing.
    2. Supress/hide most of the fields in Sales order, so that end user will be happy( thru SHDO how to do)
    Please share your experiences and help me.
    BEST REGARDS
    Srikanth

    Hi Subba Rao
    in VA01 screen - Material /qty/ after entering this client wants to enter three more details say X/Y/Z
    and after that he dont want to see maximum fields displayed in VA01 Screen.
    I think it makes sense.
    Regards
    Srikanth

  • Char displaying only the first three characters in the cube

    Hi Experts
    I have a char  with lenth 60 and it's active.I am updating this char via the update routine whereby i am reading data from an active table of an ODS as i update in the update rules.
    But surprisingly,once the load is succesful and complete,upon checking the data in the active table it's displayin the way it should be the problem comes in when I view the data on the cube which displays only the first three chars even if the descriptionis a 60 character field.
    Please help

    Hi Herbert,
    Have you checked in the infosource or transfer rules, what is the length of the infoobject, if you are loading the data to PSA, please check there it self, whether it is displaying 60 characters or only 3 characters.
    Thanks
    Sat

  • Query-only mode

    I built a form using oracle developer 9i and when I tried to insert/update/delete record I get FRM-40208 form running in query-only mode. cannot change database field.
    although I checked the properties of Data block and it is query allowed, update allowed, delete allowed (all are set to true).
    I don't know what to do in order to allow 3 DML commands.
    thanks in advance

    Hello,
    if this form is called by CALL_FORM(), check the query_mode parameter which must be NO_QUERY_ONLY
    Francois

  • Query-only mode problem

    Hello everybody, I'm a new user on this forum and in this thread I wanted to inform you about my problem and its solution.
    Problem: everytime I created a form with 10g version on DB 9i, at the moment of "Run Form", I always run in this message "FRM-40208: Form running in query-only mode. Cannot change database fields.". Obviously I couldn't nor add a record nor edit it.
    After some days spent searching for a solution, on this forum I read a post by an user talking about a very similar prob but not properly the same. Anyway, I decided to write an email to RV, an italian user who was very helpful in that situation.
    In less than an hour, he wrote me back: "Check preference in menu forms builder, you'll find a tab, if checked it gives query only mode". He also write me to post the problem and his solution on the forum.
    This morning he wrote me several mails telling me in a rude manner that I didn't posted the problem and not to write to him anymore.
    So, I'd like to tell to Rosario: dear Rosario, I thank you for your solution, and I hope that in the future you will be so kind to give users also the time to write down the problem and solutions, as I am doing now.

    I would mean only you, even if it is not worth of it, the time to write an email you have found, while the time to share the information,as I had told you, with the other forum's users, you didn't have for it.
    And then,i tell again you not to write me more, and rather I add, for the first time, reformed of you to have answered you.
    Thanks for the lesson

  • Frm-40208 from running in query mode. cannot change database fields

    Hi,
    Could some one help me with this.
    I am calling a form from another form. I am passing the parameter list to the calling form and doing a query by setting the block property. But when queries the message
    FRM-40208 Form running in query mode. cannot change database fields .
    I do not want the message to appear when they go the called form . Please some one could help me how could I avoid displaying the message.
    Regards
    Bain

    Hi,
    Good day! I am working with a module that also calls another form. It uses call_form with query mode parameter set to query_only. My problem is, whenever i call the other form using the call_form, it would display the called module and then as it populates the detail block of the called form, it will display frm-40208 from running in query mode. cannot change database fields per record. What I want is for the message to be displayed only once.
    I have tried capturing the error by using on-error trigger, but it doesn't go to that whenever the other form was being called. I think the message has to do with the post-query trigger, because it passes some values on a dbase block objects.
    Do you have any suggested solutions or workarounds to make the message display only once whenever the other form is being invoked by the call_form?
    I would greatly appreciate any suggestions/ideas.
    Thanks and regards,
    ASantiago

  • Calling another form in query only mode

    Dear all,
    Please clarify me which parameters to use while calling another form in query only mode in
    fnd_function.execute.
    Regards,
    Kiran

    Hi,
    According to standard doc:
    When you define a form function in the Form Functions window or call an existing form function using FND_FUNCTION.EXECUTE or
    APP_NAVIGATE.EXECUTE, you can add the string:
    QUERY_ONLY=YES
    to the string in the Parameters field or in the arguments string (using the other_params argument). This argument causes the form to be
    called in query–only mode. The FND_FUNCTION.EXECUTE procedure (which is also used by the Oracle Application Object Library
    Navigator) sets the QUERY_ONLY flag that sets all database blocks to non–insertable, non–updatable, and non–deletable.
    Hope it helps.

Maybe you are looking for

  • Preenchimento dos campos cEAN e cEANTrib no XML da NFE

    Boa tarde,    A partir de 1º de julho de 2011, segundo o Ajuste SINIEF n. 16, de 16/12/2010, será obrigatório O preenchimento dos campos cEAN e cEANTrib com o GTIN (Numeração Global de Item Comercial) caso ele exista. A diferença entre os campos é qu

  • IPod classic won't connect to iTunes after erase in disk utility

    I think my hard drive is failing on my 120gb classic and so I decided to wipe it and start from scratch. Admittedly I rushed into the process and wiped it in disk utility without doing much research. Now it doesn't show up in iTunes but it is showing

  • How to get the node value of payload

    Hi The null is returned when I use the following code to get the User_ID element in the payload, but there are values in the User_ID element of the payload Task task_test = wfSvcClient.getTaskQueryService().getTaskDetailsById(wfCtx, taskId); System.o

  • Iphone4 Water damage..Does rice really work and for how long?

    I dropped my iphone in a jaccuzi, and it shockingly worked after but thirty minutes later it stopped on me. Its been in rice for one whole day now, Ill keep it in there for longer, but if it doesnt turn back on what can i do? I dont have insurance...

  • Is it dangerous to install windows

    I am considering partitioning my hard drive and adding Windows.  Are there any folks who would reccommend against it?