APEX Primary Key Column Replaced by Edit - oracle

I currently have a master detail form within my APEX application which should show two columns, one of which should be the primary key.
However, it appears that my primary key column has been replaced with the "edit" button/column, which I also want to keep. When I try and edit the attributes for the primary key column, changing the "display as" option appears to have no effect, and the edit button remains.
Currently my form looks like this:
And the column attributes look like this:
And ideally, I would like an additional column to this, but with the primary key values after the edit button.
I imagine there's something very simple which I'm missing!

The edit link properties come from attributes within the column. If you click on the pencil in your second image, that will show column attributes. Look for "Action" attributes that describe the link to another page. The "Link Text" will be referencing the edit icon. You could replace this with #COPYID# to show the primary key value as a link. Or you could add another column "copyid as copyid_dsp" to show both.

Related

Modal Dialog Form Primary Key item not refreshing in Parent Page

I am beginner in Oracle APEX (Version 22.11) and I hope, that someone can help me:
I have an Interactive Report as Parent Page. I get the data with a (simple) sql query. There is also a Create-Button, which works fine. It opens an empty Modal Dialog Form, where I can fill in the entries. There is a dynamic action, which refresh this Interactive Report by Closing Dialog.
On another page I have this Modal Dialog Form, which use the same sql query as the Parent Page and have the four button 'Cancel','Delete','Save' and 'Create'. I choose also a primary key and do different setting:
under 'Processing' I make Form - Automatic Row Processing(DML) and also Yes to 'Return Primary Key(s) after Insert
for the 'Save'-Button I have the following Behavior:
Action: Submit Page
Database Action: SQL UPDATE action
Also I have for this button the following Server-side Condition:
Type: Item is NOT NULL
Item: [Item of the primary key]
Now, I have the following problem with this Save-Button (the other buttons works fine): When I edit the Radio Button or the Textfield in this Modal Dialog Form and click the Save-Button, the Parent Page takes over the changes. But when I change the Textfield of the primary key Item or when I change another Textfield or a Radio Button together with this Primary-Key-Textfield, the Parent Page doesn't take over the changes.
Where is the mistake? Can anyone help me?
I think what happens is something else than what you think is happening. As a test I created an interactive report with a form on the EMP sample table (you can generate that in SQL Workshop > Utilities > Sample Datasets). Out of the box the report refreshes when a change in the modal form is submitted. In the modal form P102_EMPNO is marked as primary key.
No what does that mean ? It means that that page item is used by the apex engine to uniquely define the row when executing dml (update/delete) on that row.
I changed the page item P103_EMPNO to a text field, enabled debug and submitted the form. This is what debug shows:
As you can see, the where clause of the update statement is:
where "EMPNO"=:APEX$PK1
I'm assuming the bind variable :APEX$PK1 is what the apex engine has decided is the bind variable for the (first) primary key column in the form.
So... if you change the primary key, then it is NOT going to update the primary key for that row. Instead it is going to try to update a row that has the newly entered primary key value. And the refresh you're expecting is not happening... because no rows were updated.
The reason is that primary keys should never be changed during normal operation in a relational database. They uniquely define the rows - that is what a primary key does. The form region is based on this principle and the behaviour that you're seeing is expected. Also, the reason that the primary key page item is hidden or display only when a form is created is that a primary shouldn't be changed.
Now if you really want to change the primary key value (my advice: DONT. EVER.) then you can probably create a form yourself and use the rowid to identify the row. Out of the box the form region does not let you select the row id.

Oracle APEX: URL column in interactive grid cannot be edited

I have an interactive grid in an APEX application, and one of the columns (header ATTACHMENT) has URLs that open in a new tab. However, as part of the functionality of an interactive grid, I am unable to edit the URL within this column. All the columns are editable, but since I changed this column to a 'Link' the user cannot edit it. I also tried single row view, but same.
Is this possible?
Thanks
See my interactive grid
How about specifying the same column (attachment) twice? One would be used for editing purposes, and another one as a link. Something like this:
select
id,
attachment edit_url,
'Link' link_url
from your_table
ID is the primary key column
EDIT_URL is a usual Text Field
LINK_URL is a Link column
its "Query only" property has to be set to "Yes"
"Escape special characters" set to "No"
When you run the page, it'll show 3 columns; EDIT_URL will be editable. Once you modify that column's value and save the changes, LINK_URL will reflect that change and - when you click the "Link" word in that column, it'll lead you to the modified URL.

How to click on Web Table column's Web Button in following case?

I have one web table, in this I want to delete particular record by clicking on record's delete button.
I got the value of row but I am not able to perform click on web button of particular row and also there is 2 buttons in one column.
How to click on delete icon of particular row?
You need to set a reference to the item within the specific row and then click on it - something like this:
Set oLink = Browser("myBrowser").Page("myPage").WebTable("myTable").ChildItem(iRow,8,"Link",0)
oLink.Click
You will potentially need to amend the "Link" and the number 8 in your own code. iRow represents the row you are trying to interact with.
Essentially what this code does is set an object reference to the first item of type "Link", in column 8 of the table, then uses a Click event to select it. If your delete icon is a WebButton, then replace "Link" with "WebButton" for example. The final 0 in the command tells UFT to select the first element matching the object type - you might need 1 if your two icons are in the same column of the table.
Let me know if that helped.

Add record with ID, selecting NAME from another table

Can anyone, please, help me with Libreoffice Base form creation?
I have the following tables:
And I'm trying to add a form to enter new RESOURCES record with the following fields: [RESOURCE_NAME], [CURRENCY_NAME] and [AMOUNT]. But after 10+ tries I have not succeeded. I have tried adding it via wizard, selecting RESOURCES as main form and CURRENCIES as subform and vice versa. I have tried VIEWS and forms based on them. These tries only gave to me or no possibility to enter new record, either creation of the new CURRENCY.
I don't need to create new currency via this form, I only want to enter new Resource (only enter once, not to modify, not to delete). Since I don't want to remember all the ID's I want to select currency name via DropDown list.
Can anyone provide instructions about how to do it, please?
Thanks.
You do not need a subform for this - just create your form document with RESOURCES as the main form (only form).
You will need a listbox to enter the currency item. A listbox has two fields, a display field and a field that is saved in the table. You will set it up to display CURRENCY_NAME and store CURRENCY_ID.
When you create a listbox, the wizard that pops up may get you what you want. If the wizard falls short:
Make sure the form document is open in design mode: on the "Form Controls" toolbar, the leftmost/topmost icon of a pencil with a triangle should be depressed. If this icon is grayed out, close your document, right-click on its name and choose "Edit".
Right-click on the listbox and choose "Control"; this will open the properties window
On the tab "Data" change the "Type of list contents" to "Sql"
In the field "List content" enter SELECT "CURRENCY_NAME", "CURRENCY_ID" FROM "CURRENCIES" ORDER BY "CURRENCY_NAME"
The Bound Field should default to 1. If it isn't 1, change it to 1.
Close the properties window and save your form. It should work as you want now.
If you want a listbox inside a tablegrid: after you create the table, with the form in edit mode, right-click on the column name you want to change and choose "Replace with" and then "listbox".
Edited to include comment by OP about bound field needing to be 1

How do I link two fields to the same table in ServiceNow?

Forgive my ignorance for the proper terminology, but let me try to explain what I want to happen.
I have two custom fields on the incident table/form. I have created a custom table with 2 columns. I have figured out how to reference the table in one of the fields, allowing me to search the entries. Now I want to link the field selection to the other field via the custom table I made. When I make a selection in field A, I want field B to populate with the other column on the same row Field A pulled from in the first place. How would I do that?
Sounds like you want what's commonly referred to as a "derived field" or a dot-walked field.
You have a reference field which stores the reference to the other table, and want a second field on the form that shows another field on that referenced table. You don't actually need to create a new element, you just need to add a dot-walked form element.
Once you have the reference field added, go to Personalize/Configure the form layout.
In the slushbucket of available fields, you'll notice that reference
fields show up in green text with a little [+] next to them.
Select your reference field and a little button will show up between the two
lists, just above the "Add" button
Click that button and the left-side available fields will show the fields available on that reference field's table.
From here, select that second field that you want to display on your form, and bring it over to the right side where you want it.

Resources