auto-populate field 2 based on field 1 in Oracle APEX4.2 - oracle

i have two fields name's as Monthly salary , annual salary.
i need to write a code in oracle apex so that if i enter a monthly salary, annual salary field should auto populate based on the monthly salary added.

The most easiest way would be to create a dynamic action, wich triggers every time, when there is a change in your first field. As action you choose JavaScript and write the function and populate the second field with the result of the function.
var Field1 document.getElementById('PX_FIELD1').value;
var Field2 = Field1*12;
document.getElementById('PX_FIELD2').value=Field2;
This is just an example, but it shows you how you can read and write from a field with javascript.

Related

Access "Page Items to Submit" values inside a trigger in oracle apex

I want to access extra page item value from a trigger which isn't in the related data table. For an example I have a table like below,
Employee
----------------------
empId | fName | lName
----------------------
1 | John | Doe
----------------------
2 | Jane | Doe
Apex form items will be like,
P500_EMPID, P500_FNAME, P500_LNAME
I have an extra page item called P500_SOMEIDSwhich is a multi select list. I want to access those selected values inside After Insert trigger of the Employee table. I tried to add this item into "Page Items to Submit". But I do not know how to access it inside that trigger. Is it possible..? and How..?
In the page process that handles your table update (that will be a process of type "Form - Automatic Row Processing (DML)", under "Settings" there is a attribute "Return Primary Key(s) after Insert". If that is set to "On", then the insert statement will return the value of the inserted row into the page item that is defined as your primary key.
Example:
Create a form on emp
Make P1_EMPNO the primary key page item
Suppose you create a new row, and that empno value is 1000. Then after the automatic row processing page process is run, the value of P1_EMPNO is set to 1000.
If you want to insert rows into another table referencing the newly created empno then you can create a page process (that executes after the row processing) of type pl/sql code like this:
BEGIN
INSERT INTO some_other_table (empno) VALUES (:P1_EMPNO);
END;
Using triggers for business functionality should be avoided whenever possible.
Instead of a database trigger, use a stored procedure which will do the same job. Pass any number of parameters you want (including the P500_SOMEIDS item).

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 :

previous record end date update in informatica using next record start date

I have a problem regarding update of end date of previous record using the next records start date. The problem is both the records coming in, in the same table load. Also there is no unique row identifier except the combination of all columns.
Example: Source Table
HICN FIRST_NAME LAST_NAME M_NAME DOB(string) START_DATE
X123 ABC DEF M ' 19600101 1/1/2013
Y456 ABC DEF M 19600101 2/2/2014
Now, (this is my business requirement, nothing I can do about it) In the target I have an extra column END DATE. This is the first load and I have to identify on the fly using a concatenated combination of First name, last name, etc etc
that the 1st and the second record are the same and if(and only if) the HICN number changes for the member I have to update the end_date of the 1st record( i.e. record with HICN X123) with the Start_Date of the 2nd record( i.e. record with HICN Y456) so my target should look like:
HICN FIRST_NAME LAST_NAME M_NAME DOB(string) START_DATE END DATE
X123 ABC DEF M ' 19600101 1/1/2013 2/2/2014
Y456 ABC DEF M 19600101 2/2/2014 12/31/1990
I have figured out how to update date cols and flag(which i did not mention above for active and inactive hicn for a member) for a second run but not sure how to do this if both the records come in the same batch. Any help would be greatly appreciated. Thanks
Try these options:
Create a column in target table like ROW_ID with VARCHAR2(100)
Create an Expression in Expression transformation with following -
MD5(Col1||''||col2||''||...etc)
'*' - is an separator to get precised output
This MD5 function will generate an 32 bit mask which we will use it in next steps
Have a Dynamic lookup on the target table
Now, every time when you receive a new row it will get added to target as well as Dynamic lookup. Hence, if you try to Match the ROW_ID field with 2nd rows calculated ROW_ID, you can easily find out the duplicate record.
MD5 is one of the best and fastest way to find dups using whole column list. DO NOT foget to create Dynamic Lookup otherwise you wont be able to find dups.
Let me know if you need further info.

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

Filter out a member from SSRS (MDX)

Ok, So I have a dim called Employee that has Employee_ID and the ID I am trying to filter out from the report table is &[12345].
How would I go about filtering out a record for just that employee ID from my report table?
You can use the Except function:
Except('a set that contains employees', {'the employee you want to exclude'})

Resources