Set value dynamic action not working in apex - sql

I have a problem creating sql dynamic action in oracle apex v4.2. I have two fields, Department number and department name. Department number is a text field with autocomplete. The department name is a display field. On changing the department number, the department name should be displayed by an sql query.
I created a set value dynamic action on department number, giving the correct values in page item to submit and the correct sql query referencing P3_DEPARTMENT_NO.
When i run the page, after select a department number, the department name is not coming up automatically.
Could you please suggest on what i might be missing.
Thanks in advance.

You can try use this way:
First step: In the Shared Components -> Application Processes: create a process myProcess an put your sql dynamic in.
Second step: Create a javascript function myFunction to call the process myProcess.
Third step: Use onChange event to call your javascript function myFunction.
Also you can find a lot of exemples on Denes Kubicek app: https://apex.oracle.com/pls/otn/f?p=31517:101:116042570427567.
Best regards,
iulian

The exact behaviour of autocomplete lists is probably browser dependent, but generally speaking, don't rely on the "Change" event, as it won't necessarily fire when you select from the list.
You'll need to experiment to get the behaviour you want in your particular situation, but as a starting point you might want to try replacing the "Change" event type on your dynamic action with "Lose focus". That way the dynamic action should always be triggered when you tab or click away from P3_DEPARTMENT_NO.
In similar situations in the past, I've used "Key release" instead of "Lose focus", and I've created a second dynamic action which does the same thing, but triggered by "Get focus". That combination ensures that the display field stays synchronised with the user's selection, whether a value is keyed in or selected from the autocomplete list. Whether or not you go this route depends on how happy you are about the database being hit with your department name query every time a user interacts with P3_DEPARTMENT_NO in any way.

Related

How to Retrieve a Custom Event Name in Azure Stream Analytics

I created a custom event that is tracked by Azure Application Insights. It has a few custom data properties I am able to successfully track, as well as 2 custom event properties of interest (one of which I cannot display).
The one I cannot successfully query is the event name. I'm trying to reference it in the query by using event.name, but it's returning null for all records, even though I know for sure the names are not actually null.
If anyone knows the proper way to query the custom event's name, please let me know! I can't find it on: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-export-data-model
The issue here is name is in an array, so event.name returns NULL since it doesn't exist.
Will you always have only 1 name in this array?
If so the following query will extract that value:
SELECT GetRecordPropertyValue(GetArrayElement(event, 0),'name') as eventName from input
If you have various names, the query will depend of the logic (hence the suggestion to use CROSS APPLY).

How to create a dynamic LOV at runtime

How to create a dynamic attribute in lov at runtime?
Suppose I have a employee lov, where only two attributes are currently present like employee id and employee name.
It user want to add a few more column at run time like employee age and employee salary.
Without changing the LOV logic. The user has one master table where IT user can handle how many attribute should be displayed to business user. They can add a new parameter in table which can be displayed.
Can anybody suggest me some approach to handle this type of scenario?
If I got you right, I'd use backingBean with method that returns List, that implemented as ArrayList<SelectItem>. Then populate from any source(like VO, or whatever mixed) label and value according to your current user request.

Access 2010 VBA and filtering

Good Day,
I need some assistance please. I am rebuilding a third party Access database after it's catastrophic failure and the failure of the 3rd party developer to fix his mess. I am an avid Access Developer and know my way around an Access Database well. I am not a super VBA coder, but I can do more than my bit in VBA as well as a few other languages.
Currently, I have a database test bed with a login form that stores 3 values as public variables (gstrLevel as String, gstrUser as String, gintID as Integer). I am able to set my own "permissions" with ease in that once they login I can use the values to control the switchboard etc.
My problem now is the following. We have people recording prospective client interactions and interviews. As part of the process, every time they make contact, they record this into the database and in the process a "followup date" is created. This works like a charm. What I now need to do is warm the users if these followup dates are close or have passed so that prompt action can be taken lest we lose a prospective client.
I have a query that takes the prospective table information, and the notes table information (where the followup date is stored) and then filters the dates correctly. This in turn has been used to create a continues form to display the records that need followup soon. What I cannot seem to do is to get it to only show the logged in users followup records.
I should note that the user/agent field is a lookup field in the prospective table, and thus also creates a combo box in the Followup form. I can lock the form from changes etc, but I can't seem to get it to only display the relevant user/agent details.
I have tried:
DoCmd.ApplyFilter
Me.Filter
Me.FilterOn = True
DLookup as criteria
Using my public variables directly as query criteria
And a few other weird combinations with no success.
My problem, I believe, is the fact that the user/agent is a lookup field, and I am not sure how to filter based on that fact. If I use the gstrUser variable directly I get a type mismatch and if I use gintID directly it shows nothing.
Any ideas or advice would be greatly appreciated.
You probably have a Users table, with a numeric Primary Key (PK), while your gstrUser stores the userName.
So in the source of your Followup form, just add the Users table (joined to the Prospective table on UserId) and apply the filter on the userName field in the Users table (or whatever it's called that matches the contents of gstrUser).

LightSwitch HTML Client save calculated results to new field

I'm using Visual Studio 2013 LightSwitch to attempt to build an HTML application. After trying for several hours to get a "computed" column/field to show up in the HTML client, I realized it's not possible. I thought about building a trigger to fire on the table, but that won't get pushed when I publish the application. So, without using a RIA client, what's the best way to calculate using two or more datasource fields and store in another? It can be triggered when the user clicks the save button or even when the fields contain data that can be computed.
For example, Table Users (before):
First_Name (string) Last_Name (string) Stored_Full_Name (string)
John User NULL
Jane Doe NULL
When the user clicks save, or when first_name and last_name are not null, "Last_Name, First_Name" is stored as a single column in the Stored_Full_Name column in the same table.
For example, Table Users (after):
First_Name (string) Last_Name (string) Stored_Full_Name (string)
John User User, John
Jane Doe Doe, Jane
I'm assuming the same technique could be used to calculate costs or other items?
Any example code would be greatly appreciated.
For simple computed properties, you can always create functions on the Users prototype.
It's explained in this blog post: http://lobfactory.wordpress.com/2013/05/03/computed-fields-in-the-html5-client/
This is pretty easy. Create a string-typed screen variable called "FullName" with display text of "Full Name". Edit the Screen's "create" method and assign the value you want to the variable in JavaScript. - in the example above you'd want something like the following:
screen.FullName = screen.Last_Name.value + ", " + screen.First_name.value;
Then drag the variable from the data tab on the left onto your screen into your Users table.
You might need to update the computed value as part of your Save pipeline, but the create() method should fire any time the screen is redrawn. If you want to save this into a nullable column within your Users table you can do so by simply assigning the field value to the new value, but I'm not sure why you'd bother as this breaks your table's normalization. In the function where you pre-process saved changes on the client-side, add the following code to make this so anyway:
screen.FullNameTableField = screen.FullName.value;
I use a very similar technique for creating in-row "Edit" and "Delete" record-level table entries.
HTH

Rails 3 Saving User Searches DataModel

I am working on a piece of my app where the client is wanting the ability for user searches to be saved (these searches are completed by the user completing a set of dropdowns and then entering in a value in an input field).
I was curious to know if the use for an HSTORE could be beneficial here or should I just simply save out each piece of the search?
For Example (from a UI perspective):
User Selects a category, the next select is populated with stats tied to the selected category, the next select drop down is displayed which allows the user to select a predicate (greater than, less than, equal to, not equal to, etc) and then the input field is shown where the user can enter in their value they are searching for. If the user would like to add another search filter, they can click a button and then the user follows the same pattern as the first
The server side params look like this:
Parameters: {"utf8"=>"✓","authenticity_token"=>"FCvOdXuxtEhEchwDn8U2yaEPShfHW2VosgSoR8eSzV8=", "refresh"=>"1", "search"=>{"0"=>{"category"=>"1", "stat_type_id"=>"5", "predicate"=>"Greater Than", "q"=>"200", "type"=>"stat"}}, "unselected"=>""}
These searches won't really be updated, when a user enters in a new search, it will be saved explicitly.
Once we figure out the best route for this project, I will post the code as the answer