Very simple research tool in APEX - oracle-apex

I am trying to do a very simple "Research" tool in Apex.
What i did so far is
Created a textbox
Created a button with the attribute /Always submit page when enter pressed/
Wrote this query in the report page - Source - Source region
-
"select NO, TITRE_CONFER, NO_CONFCIER, NO_FILM FROM S4_CON_VRAI
where titre_confer like '%' || :px_2 || '%'"
This is pretty much a table with conferences that are either taught with a film or a person. I am looking to filter the TITLE of the conference. px_2 is my textfield.
So, if you enter any letter, it should filter with the right title.
The problem is that whenever i click GO, nothing happens. He still shows me the whole list.

The step and query i wrote are 100% functionnal.
The actual problem was that I had wrote :px_2 but it was :p2_x.

Related

Oracle APEX 21.2.6 Interactive Grid - double-click to edit popup LOV shifts data rows over. How to prevent this?

I have an IG display that looks like this without clicking anything else:
Only Supervisor, and Direct Supervisor are editable, and they are both Popup LOV's.
If I double-click the Supervisor data, and immediately type any letter for the Popup LOV search, the data row(s) display shifts to the left like this:
It doesn't matter how wide the window is when I test this. I've been looking for ways to prevent that shift. Do you have any tips to resolve that?
Thank you
I've since learned that this is a known issue, and a bug report was logged: https://community.oracle.com/tech/developers/discussion/4340268/apex-20-1-popup-lov-in-interactive-grid-causing-issue/p1?new=1
I've also noticed that it seems to happen from a single click plus typing to search - not necessarily from a double-click.
Finally, freezing a column or two in place in the IG display appears to prevent the visual shift of the columns.

How to insert and update the inserted row in Oracle APEX?

I want my "Create" button to insert a row on a table and once inserted to update that row. The reason I need to insert that row first and then update is because some columns that I want to update depend on the value being there in the first place. For example I would like to update the "Gross Margin" column but the "Gross Margin" = Payrate + something else. If I don't have the value in "Payrate" column, well there is no way I can update "Gross Margin" since it depends on it.
What I have tried:
) Create a Dynamic Action that triggers if "create" button is clicked. If its clicked is true then run the 2 true actions of type "Execute server side code" which is the Insert statement and the other is the Update statement. I made sure that Insert has the first sequence(It runs first) then the update(It runs second). Please see below picture of the settings of the "Create" button.
Please see below picture of the settings of the "Dynamic action"
See below settings of the "Insert Action"
Below settings of the "Update Action"
2.) I have also tried by creating a "Process" that is binded to the "Create" button when clicked but it did not worked.
I am open to all suggestions and thank you in advance!
I created a workspace on apex.oracle.com to illustrate my answer:
workspace: SO_HELP, username: so_68399404, pwd: so_68399404
App 22384 (Demonstration - EMP / DEPT) is an app generated on the standard emp/dept sample dataset. In the report "Employees", there is a "create" button but employees can also be edited with the edit icon. Both the "create" button and the "edit" link point to the same form (page 4). The salary is depends on the job. If the job is MANAGER then salary is set to 5000 else salary is increased by 1. Similar to your requirement. I did this with an after submit computation with code
CASE WHEN :P4_JOB = 'MANAGER' THEN 5000 ELSE :P4_SAL + 1 END
No other code needed. No dynamic actions, no custom processes. All updates are handled by the process of type "Automatic Row Processing - DML". Login with the credentials above and have a look. If it is not what you need, please explain exactly what is different in this app - or create a new form/report on that data to illustrate your issue.
May I suggest you ask your questions this way ? Extract your problem out of your code and illustrate it with the sample dataset. No one knows your actual data, everyone knows the emp/dept schema. That can avoid endless discussions in the comments.

Oracle ApexCreate Time field HH:MM

I am having difficulty with a duration field on my form/table.
The users need to indicate in HH:MM how long a meeting took.
What datatype should the column have in the Table. Currently it is TIMESTAMP
How can I make the field have an input mask of 'HH:MM'. What I would like is for the user to be able to type '0130' and the field format it to '01:30' immediately.
Reporting on these times is required so I assume that entering the data as VARCHAR will not help.
Honestly, this is not such an easy subject as people might think it is, and probably more from a user interface point of view than technically.
The easiest way out? The apex datetimepicker. And honestly, if you're new to the technology I'd advise you to use this, especially if you want to steer clear from javascript/jquery initially.
Let's put it this way: the datepicker is fine and works good, but time is really not that fantastic.
Not all that hot right. The value in the input item does not change until you hit 'Close'. The time component seems like a last second sloppy addition honestly. It works, however. (But I'd still set the field to readonly so that a user can not enter text directly.)
Allowing text to be entered means it needs to be validated according to the correct format mask. And format masks differ between those in jQuery (the datepicker) and those in Oracle, and it might be possible that your oracle format mask is not possible in the datepicker, adding even more complexity. There is also no 'live' date validation (nor datetime), there is only the builtin item validation which will check the format mask and which fires on submit.
Anyway, I'd say take a look at it. Set your item to be displayed as a Date Picker, and use the format mask under settings to get the datetime picker:
Now you can push it further of course, though it'll cost some effort. There are several options though.
Personally, when I've implemented date+time I've always split the date from the time in 2 fields. 1 with the date component, and one with the time component, while keeping the item with the original value hidden (so 3 items total). I then use the datepicker on the date item, and use jquery timepicker plugins on the time item. On submit I then add the 2 values together and parse them in a date, and put this value in the original item again (to allow the standard processing to work on items with source set to database column).
One example of a timepicker is here, another one here. They're both not that hard to implement. They have good documentation too. I don't want to dive in the implementation of it here though, I advise you take a look at it first and see how much it scares you. (I'd set up an apex demo but am a bit pressed for time at the moment).
For example, using Trent's (second link) plugin:
put the js file in the apex images directory. I made a folder "/custom" in my case
add the required js files to the page (assuming apex 4.2, put this in javascript file urls)
#IMAGE_PREFIX#libraries/jquery-ui/1.8.22/ui/jquery.ui.slider.js
#IMAGE_PREFIX#custom/jquery-ui-timepicker-addon.js
use onload code such as this to initialize a field
$("#P95_DEPARTURE_TIME").timepicker({hourGrid: 4,minuteGrid: 10});
It'll end up looking as this:
Any further interaction between pickers will need to be handled in javascript code if you want it live. Don't forget server validations.
As for items, my hidden date item has format mask DD-MON-YYYY HH24:MI. Format masks are important, because items are bind variables, and bind variables are varchar2. The value in the html form is also just that, text.
For example, this is on my displayed date item, with a similar setup for the time item:
Then in an after-submit computation I glue the values together again and put them in the m that'll save the value to the database:
:P95_DEPARTURE_DATE_DISP||' '||:P95_DEPARTURE_TIME
This is just a short guide on the setup though, but might be interesting once you're a bit more familiar with the product.
There are also 2 timepicker plugins on apex-plugin, but honestly I don't find them interesting at all when compared to these already existing fine jquery plugins.
Give it some thought and look at it.
If quarters are enough..
item: text field with autocomplete
SELECT ss|| ':' || dd ss_dd
FROM
(SELECT to_char(trunc(sysdate)+(level - 1)/ 24,'HH24')ss
FROM dual CONNECT BY level <= 24),
(SELECT lpad(mod(15 * level, 60), 2, '0') dd
FROM dual CONNECT BY level <= 4)
APEX 4.2: Just to shed some light for any future viewings; now there are loads of Apex plugins for the purpose of picking Date/Time or both returning variations of date time formats as you would required. For e.g. as in your case HH:MM or HH24:MI.
I have personally used TimePicker plugin from http://www.apex-plugin.com which I have no problem in recommending.

webservice for autosuggest on city names / postal codes including long-lat coordinates?

i'm looking for a webservice, to be used for an autocomplete field,
where people can fill in either a postal code / city name or both
this service will need all cities in Europe, so we can use it for all country websites.
and in a later stadium we want to keep the world open for asia and america so this would be a plus.
preferably it would also return the long-lat coordinates for the locations,
Now it is a free textfield, after leaving the field, we hit the google geocoding service,
to find coordinates... preferably i would tie these two together.
so we don't have to query 2 services for one thing.
does anyone know of the existance of such a service online somewhere?
or would you suggest to build our own database with cities / postal codes / coordinates?
if so we would need to get the content from somewhere too, and i was trying to avoid that issue :)
I recently searched for a similar service, in vain.
I wanted my users to have auto-complete on entering a city name, and once a city is chosen I needed to pass the name and lat/long onto the Google API. In the end I did this: -
downloaded the geonames allcountries.zip, full extract: this
Imported it into a SQL DB via SSIS (about 7.5 million records!)
Wrote a simple query to extract just the cities (only the PPLC, PPLA and PPLA2 records).
This left me with a manageable table of 9112 records (with lat / long and country code) which covers all the cities in the world. I then wrote my own code to query the data.
Not ideal, but I needed a solution.
I know this post is very old but for thouse who are looking for a simple solution that can be integrated in 5 minutes here is the link:
Geocomplete jQuery...
For my case I followed this steps:
1 - Download the plugin from here.
2 - Add the jquery.geocomplete.js or jquery.geocomplete.min.js file into your javascript folder of your project.
3 - Call this file in script tags on the html page where you have the input field that you have to autocomplete with cities:
<script src='/PathToTheFile/jquery.geocomplete.js'></script>
4 - To convert an input into an autocomplete field, simply call the Geocomplete plugin in script tags: <script>
$("#IdOfTheInputField").geocomplete(); // Option 1: Call on element.
$.fn.geocomplete("input"); // Option 2: Pass element as argument.
</script>
5- You can check for the complete list of options on the link provided at the top.
Hope that this helped!

Track inventory feature with dynamic created "add to cart button"?

i have actually use form code to auto-generate information and etc.
I was wondering if i can implement the "track inventory qunatity" using dynamic generated buttons , just like in the website?
If this is not possible, how do i actually counter check with my own item quantity everytime a user press "add to cart" and it will minus off 1 quantity from my database.
And when they cancel the checkout , i would get the "-ed 1" back to my database?
Thanks alot, this is my first time working with paypal and have totally no clue
you would most likely handle that in your database with a stored procedure