Set interactive grid value based on dropdown select list - oracle

I am trying to make a cost value populate in an interactive grid column based on the value selected in an Item column.
My setup is:
An "Item" table which contains a list of Items, and the "Cost" assigned to the item.
A "Quote" table which contains general info about the quote, i.e. company name, date created, signed, signed date etc.
A "Quote_Items" table which assigns an Item to a quote by Quote_ID, and Item_ID. I added a Cost column to the Quote Items table to be able to see it in the interactive grid, and update it.
For the Quote Items I created an Interactive grid to add Items to the quote.
I set the Item_ID column in my interactive grid to a popup LOV which populates the Item_ID based on the selected item.
To populate the "Quote_Item.Cost" I added a dynamic action to the Item_ID column to:
Event:Change
selection Type: Column(s)
Region: ..Item List
Column(s): Item_ID
Action: Set Value
Set Type: SQL Statement
SQL Statement: SELECT I.COST
FROM WIP_ITEMS I
WHERE I.ITEM_ID = ITEM_ID
Items to Submit: COST
The result is, when I select an Item from the dropdown, all values in the "Items.Cost" table are displayed in comma separated values in the field:
Quote Item populating all item costs in one field
It seems like the "WHERE I.ITEM_ID = ITEM_ID" part of the SQL query is not working correctly? How can I get it to show only the Value associated with the Item_ID?

Syntax to reference a column in the SQL query > :COLUMN_NAME
So your SQL query should looks like this:
SELECT i.cost
FROM wip_items i
WHERE i.item_id = :ITEM_ID
And you need to modify the "Items to Submit" parameter too, because it must always be the value which your reference in the where condition, so in your case it should be:
Items to Submit: ITEM_ID

Related

Cascading LOV - Invalid number while updating record - Oracle Apex

I have a select list based on other select list. It works fine on the create screen but gives 'Invalid number' error in update screen.
SQL query:
select description, account_id
from t_account
where chart_id = :P15_chart_name
Please help me out!
You are trying to convert a string into a number, and that failed.
As Select List item has 2 values: 1st being display and the 2nd return value, it is the 2nd value that causes problems - account_id in your case.
For example, it contains value A while column that is supposed to accept this value is declared as NUMBER. Oracle can't convert A into a number and raises an error.
What to do?
make sure that Select List item LoV query returns only numbers, or
modify column's datatype to varchar2
If that's not it, then :P15_CHART_NAME item and chart_id table column differ in datatypes; a simple option is to fix page item's datatype.

Oracle Forms Post-Query FRM-40735 and ORA-01422

I want to display the item from different table, I am using POST-QUERY trigger
:
SELECT Stock_code
INTO :exchange.stockcode
FROM Exchange_Stock
WHERE Exchange_code = :exchange.Exchange_code;
it come up with FRM-40735 and ORA-01422
but it display some of the record (not all),
I have no idea what is wrong
Most probably the POST-QUERY trigger fires just after the fields of table-based block with multiple records are populated. Obviously Exchange_code values are not unique throughout the table data, whereas a SELECT .. INTO .. FROM ... clause only can bring one row record.
So, you can try to filter out the results so as to get single rows for each parameter fields combinations such as :exchange.Exchange_code & :exchange.code_order instead of only :exchange.Exchange_code field within the WHERE condition :
SELECT Stock_code
INTO :exchange.stockcode
FROM Exchange_Stock
WHERE Exchange_code = :exchange.Exchange_code
AND code_order = :exchange.code_order;
where important thing is to get single row from the query matching for each record in the data block. You can still add more condition to the query if this condition is not provided yet.

Forms Builder showing MaxValue

I'm new to Oracle Forms Builder and I want to display only the max Value of a column. How can I do this?
I presume
You created a Data Block(let's call emp) which has a Query Data Source Name (assume
Oracle's famous emp table)
with Multiple Records Displayed,
and of type Tabular.
Add a max_empno to the Data Block emp, under the item empno
with Number of Items Displayed property set to 1,
Database Item property set to No,
Calculation Mode property set to Summary,
Summary Function property set to Max,
Summarized Block is emp,
Summarized Item is empno.
and setting Query All Records property of the block emp to Yes
shouldn't be forgotten. Then, When the form module is run, the
following interface will appear :

Oracle List of value (lov) refresh when select any row

I have created a LOV on oaf page. The issue is when i select any row from LOV page, it's reloading the (lov) page instead returning the values to back page.
If we keeps opened LOV window for more than 5 minutes and then select any row, it works.
Thanks in advance
In OAF, while creating an LOV, i.e., messageLOVInput item, lovMap is required to be set.
Make sure the LOV Region Item, Return Item and Criteria Item in this lovMap is set properly.
LOV Region Item : field from which value is picked from lov table
Return Item : field in which value should be set on selection from list of values
Criteria Item : field which is validated for value

filter tablix without datasource values in ssrs

I have SSRS report and I need to filter a static table that I created inside the report based on parameter. There is no data source to this table and I'm entering the data manually.
The tablix contain 3 columns.
How can I filter the columns based on parameter?
I tried in the expression =#param1 for example but it doesn't work.
For now I only manage to filter if the expression is on data source fields.
Do you literally have a table with a number of values in it written directly into the report? If so I don't think you will be able to perform any filtering on it as effectively all you've done it write data into textboxes that are displayed.
I would imagine your best option would be to instead create a new dataset and populate this with your static data, e.g.
SELECT 'A' AS Letter, 'English' AS Language
UNION
SELECT 'B' AS Letter, 'French' AS Language
UNION
SELECT 'A' AS Letter, 'German' AS Language
To give you a table as follows
Letter | Language
-------+----------
A | English
B | French
A | German
That you could then filter on Letter = A
So essentially you have a Tablix that has 3 columns pre-populated with information you have manually entered into the text boxes themselves? Since you've already entered that data, I don't believe there is a way to filter that at run time. That data is hard coded in essence. The Filter ability in SSRS is used as a WHERE clause so it restricts what is brought forth into the report from the query.
I would create a data source connection to a dummy database, create a DataSet, and create a query that fills a temporary table will all the information that you've manually entered. Once you create the temporary table and inserted values into it, you can then perform a SELECT with a parameter. Your Tablix will only be populated with information that matches the parameter. Something to the effect of this:
CREATE TABLE #TempTable (
ID INT
,Name VARCHAR(MAX)
,Email VARCHAR(MAX)
)
INSERT INTO #TempTable (
ID
,Name
,Email
)
VALUES (
1
,'Bob'
,'bob#email.com'
)
,(
2
,'Frank'
,'frank#email.com'
)
,(
3
,'Jim'
,'jim#email.com'
)
SELECT
*
FROM
#TempTable
WHERE
ID = #ID
DROP TABLE #TempTable

Resources