Oracle Forms - EXECUTE_QUERY not working - oracle11g

I am trying to create a button which does exactly the same work of 'execute query' button in the smart bar.
Below are the steps I tried, but isnt working. Please tell me what am I doing wrong.
I am creating a simple form using Oracle XE Express Edition 11g and Oracle Forms 10g.
This is a very simple form that displays employee details (Form).
I created a button 'Display', which when pressed, calls execute_query;
When I clicked display button, it gives:
FRM:40202 : Field must be entered.
Additionally the cursor is blinking in the Employee ID field. The 'Execute Query' button in the 'Smart Bar' works fine.
Could you please show me how to make it work?

Ok Guys... Got the fix from a different forum.
Go to the property palette of the field where the cursor is (In my case it is Employee ID) --> Under 'Data' --> 'Required' --> set to 'NO'
The above method will work but a better approach is
in PLSQL Editor (button - When_button_pressed) - enter the below code
GO_BLOCK(NO_VALIDATE);
EXECUTE_QUERY;
Then in property palette --> Mouse Navigatable --> set to 'NO'
Save and run the form... You are good to GO.

write a query EXECUTE_QUERY(NO_VALIDATE);
then it will not show an error FRM:40202 : Field must be entered.

Related

How to Add New Record from Subgrid in Dynamics CRM with Easyrepro

Does anyone know how to add a new record from subgrid in dynamics CRM with Easyrepro?
xrmApp.Entity.SubGrid.ClickCommand("subGridName", "button", null, null);
I used this line but it gives me an error saying no command of this name exists.
I just need to click the Add New button on the subgrid.
I found a custom way to do it as the Easyrepro team didn't make a built-in method for this.
I would search the button from its text and click on it as shown below.
Make sure the target window is the main window
var xrmBrowser = client.Browser;
var win = xrmBrowser.Driver.SwitchTo().Window(xrmBrowser.Driver.CurrentWindowHandle);
Find the button, let's say the button name is 'New Message' with its text and click on it.
win.FindElement(By.XPath("//*[text()='New Message']")).Click();
xrmApp.Entity.ClickSubgridAddButton("subGridName");

Google Appmaker: Update form based on selected dropdown option

I have an AppMaker app that has a from based off of one address table/datasource. I can get a form with next/prev buttons, but replaced the key field (name) with a dropdown list of all names (a user can start typing names to jump there, with the dropdown showing).
My hope is that when a user selects from the dropdown, the entire form updates and the next/prev buttons work properly as well (there too many records to page thru with next/prev only). I don't have to have next/prev functionality if it complicates things too much.
Currently the dropdown is working, but I cannot get the index for the next/prev buttons set or the rest of the form to reflect the selected dropdown record.
I've tried to set the "onValueEdit" event to something like this...
var selected = widget.value;
var idx = widget.options.indexOf(selected);
console.log("Selected: "+selected+", index = "+idx+"\n");
if(idx < 0) { //...this error is never hit
console.log("Index error - setting to zero!\n");
idx = 0;
}
widget.datasource.loadPage(idx); //...update form?
Two observations via console logging:
The "idx" var is never set to the selected dropdown index reliably, and is
often "0" (tho no error msg ever shows), so the "indexOf()" function
isn't working as expected.
The "selected" var (name) is always correct.
If I call widget.datasource.loadPage(...) with a fixed value (say 5) it has no effect on what is shows in the form either (previous loaded data remains) - obviously not the way to do it :v/
Can you steer a noob in the right direction?
If you are using default App Maker form, then you can see that so-called pager, doesn't actually paginate. It triggers prevItem/nextItem datasource methods, in other words it navigates through datasource items, not pages. Here is a quote from App Maker docs:
nextItem: Selects the next item. For Query Datasources, if the current item is the last item on the page, then this loads the next page and selects the first item on the newly loaded page.
So, if you already have all your items loaded(you set query page size for your datasource to 0), then you need just to change selected item within datasource:
// onValueEdit dropdown event
// assuming, that form and dropdown share same datasource
widget.datasource.selectKey(newValue._key);
If you really have lots of items and it is not feasible to load all of them in one call... then it will be all another story...
UPDATE:
It's important that Options and Value are set as shown in the image below!
However, I had trouble setting them that way (read: wasted hours!) until I wiped them both completely using More options in the binding picklist, and tried again (I had even tried on a brand new app!). I was being forced to choose ..projections.. and then a final field before the OK button would be available.
Not sure if AppMaker is buggy here or there is something simple I'm not understanding!
None of the coding in my original question is required.
Once set this way, binding just works as you would expect it!!
All other fields are set as #datasource.item. and are bound to whatever item is chosen. No Events settings are necessary for the dropdown either, as I thought they might be.
I deleted this page and started again, and replaced the default business name data field with a drop down, I set the dropdown as:
Options: #datasources.Addresses.items
Value: #datasources.Addresses.item
It works fine?! Not sure what happend in my original page!
UPDATE:
So it seems you need to delete both the Value and Options and then re-enter these. The OK will light up when you do.
Also, my original take on App Maker was to build the UI and attach data. That was my first mistake. You build the data then have App Maker build edit/add pages for you.

ASP.Net Code Optimization

I have almost every piece of code, I just need it to be optimized using correct IF_ELSE conditions and arranging the right flow.
I have a webform (UserProfile.aspx), which contains FormView (to display user profile).
In FormView ItemTemplate, I have put simple HTML and ASP.Net Labels to display Info using Label's Text property :
Eval("col_name");
In EditItemTemplate, I have same table with but textboxes instead of Labels.
I have a button "Edit", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.Edit); [ WORKING ]
I have another button "Cancel", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.ReadOnly); [ <-- NOT WORKING ]
To display user profile, I'm passing user-id from querystring (querystring field = "user")
So the valid URL looks like :
/UserProfile.aspx?user=121
What I want to achieve is :
If (user_IS_Logged_In)
//Some basic tasks like setting welcome message label with username/email etc.
If (querystring_is_EMPTY OR querystring_field_is_incorrect OR user_IS_NOT_Logged_IN)
//Remove the Edit and Cancel buttons
If (querystring_field_is_exist)
//initialize user_id (this will be passed to ShowUserDetails(user_id))
If (user_IS_Logged_In AND querystring_is_exist)
If querystring value and logged in user_id ARE NOT EQUAL THEN
//Again Remove the Edit and Cancel buttons
P.S --> I'm thinking to add an UpdatePanel around the FormView Once I achieve above tasks, for consistent look.
I know the problem is quite difficult to understand so feel free to ask details.
I will provide the code as needed.

netsuite add button to a record

I'm really new to NetSuite programming, and I'm having troubles adding a button to a record.
I want to add the button "Create Lead" next to the "Edit" and "Back" buttons of a record.
I have created a user event script, and this is my before load function:
function beforeLoad_addButton(type, form, request){
form.setScript(customscript_cue_new_lead_record);
form.addButton('custpage_add_createlead_button', 'Create Lead', 'createLeadRecord()');
}
I am setting a script to call a function on an other .js file.
This doesn't add a button like I would want it to. Can anyone help me figure this out? Thanks.
The first thing I see is that your call to .setScript needs to pass the ID as a string; you have no quotes. It should be:
form.setScript('customscript_cue_new_lead_record');
Not sure if this was just a typo, but if that's how your code is, then this is probably throwing an error with something like "customscript_cue_new_lead_record is not defined" if you check the execution logs of your User Event script, which is stopping the rest of the script from running so your button isn't being added.
Everything else looks correct to me. You've got the custpage_ prefix on your button ID, and the code to execute as a String.
I don't see anything wrong with your script so make sure that you already deployed the said script as user-event script.
Setup > Customization > Scripts > New
Select Type: "User-Event"
In the new window fill up the necessary details and upload the js file. Make sure to put this function.
Before Load Function : beforeLoad_addButton
This will add the button in view and edit mode. Hope that helps.

How do you access the title (Node module element) field in Drupal 7?

I have a computed field in a Drupal 7 content type that is populated by my description (text) field:
$entity_field[0]['value'] = $entity->field_desciption['und'][0]['value'];
It works fine. I want to create another computed field that is populated by the title (Node module element) field.
I tried with the following lines, but they don't work.
$entity_field[0]['value'] = $entity->title['und'][0]['value'];
$entity_field[0]['value'] = $node->title;
How can I achieve this?
The node title is not a field; therefore, using $entity->title['und'][0]['value'] will not work. What you should use is $entity->title.
As side note, to get the value of a field, you should use field_get_items(), which takes care of the language set for the field, which isn't necessarily LANGUAGE_NONE.
If it's a node module element, it should be accessible via $entity->title directly.
Try a print_r($entity); die; to get all elements of the entity. Hope this help you.
You should look at printing the array/object to the page to see what you are working with exactly.
Try adding print_r($entity); or print_r($node); to the page where the entity or node is displayed followed by exit;
You can then right click the page and click 'View page source' to display the output in a structured format. Use this to see the variable names, object/array types and hierachy to then write your full variable code correctly.
print_r($node);
exit;
I would imagine it should have been $node->title though...

Resources