I have two items P1_ENDTIME,P1_CURRENTDATE. The first item(P1_ENDTIME)has value which i am getting from interactive grid column. And in second item(P1_CURRENTDATE) is having current date.
I want to disable the button when current date(P1_CURRENTDATE) value is higher than end time (P1_ENDTIME).
Create a new page item P1_ISFUTURE
Create a dynamic action on change of P1_CURRENTDATE
Add a true action of type "Execute Server-side Code"
PL/Sql Code:
IF TO_DATE(:P1_ENDTIME,'DD-MON-YY') > TO_DATE(:P1_CURRENTDATE,'DD-MON-YY') THEN
:P1_ISFUTURE := 'Y';
END IF;
Items to submit: P1_ENDTIME, P1_CURRENTDATE
Items to return: P1_ISFUTURE
Add a true action of type "Disable" for the button with client-side condition of type "Item = Value" and values P1_ISFUTURE, Y
Add a true action of type "Enable" for the button with client-side condition of type "Item != Value" and values P1_ISFUTURE, Y
Side Note: You don't need to store the current date in P1_CURRENTDATE. Instead you could just use
IF TO_DATE(:P1_ENDTIME,'DD-MON-YY') > SYSDATE THEN
:P1_ISFUTURE := 'Y';
END IF;
Related
I am a beginner in PL/SQL and Oracle Forms .
I am working in an Oracle form. Created a push button and updated it to item type: list item. I want to choose between items when I click on it. I should redirect with if according to the item chose. How can I do that?
NOTE: I'am using forms 6i ,
item_type : list item
list style : popup list
elements in list : S_SATIS(value : item24) - S_MARKA(value : item25)
trigger : when-list-changed
This is how I got list item name and values:
l_count := GET_LIST_ELEMENT_COUNT('list_item');
FOR i in 1..l_count LOOP
IF GET_LIST_ELEMENT_VALUE('list-item',i) = :list_item THEN
l_text := GET_LIST_ELEMENT_LABEL('list_item',i);
l_value := Name_In('list_item');
I want to redirect according to the item selected with if. This is the method I think is correct. But it is not working correctly. I used message to see if it goes inside the if . but it didn't print the message. How can I fix?
ELSIF l_value = '<list item value name>' THEN
message(l_value);
GO_BLOCK('<block_name>');
EXECUTE_QUERY
ELSIF l_text = '<list item name>' THEN
message(l_text );
GO_BLOCK('<block_name>');
EXECUTE_QUERY
this way the problem is solved
I am trying to set a interactive grid column value (which is a date) based on a page item (which is also a date). I have already tried defaulting and using dynamic action set value (jquery seletor) to set item value to the interactive grid column but it does not work how I want it to work.
I have a page item called "P_DEF_DATE" and I want to set a date column in the interactive grid to this value but I want when I change the value in the page item and I click add row on the interactive grid, it must always use whatever value I have in the page item. For example:
P_DEF_DATE = 12-JAN-2021
when I click on add row in the interactive grid, my date column must equal to P_DEF_DATE and i add a few rows based on that date but then i change the date of P_DEF_DATE to:
P_DEF_DATE = 28-JAN-2021
now I want when I click on add row in the interactive grid, I it must show this new date from the page item in the date column in the interactive grid, keeping in mind the page does not refresh and I have rows with the date 12-JAN-2021.
Thank you in advance!
I implemented same few days ago. Following is what I did.
Create Dynamic Action on Row Initialization Event, set Region to your IG
Set True Action to Execute JavaScript Code
Use code
var model = this.data.model,
rec = this.data.record,
meta = model.getRecordMetadata(this.data.recordId);
if ( meta.inserted ) {
model.setValue(rec,"COLUMN_NAME", $v("P_DEF_DATE"));
}
Replace JOB with your column name and P_DEF_DATE with you Item name
More details Here
Also, out of curiosity, why there is no number like P1, P2 in your item name ??
I am currently working with the Apex Office Print it would be nice if you could help me with two points.
I am creating a template with a lot of fields, and around 50% of
these fields are optional, so they are often only (null) in my
database. Can I do something so that the fields with no value are not
shown?
My second question would be the work with the print function and
checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so
that I only print the content of a selected checkbox ? It is not
really working in the PL/SQL section.
I am creating a template with a lot of fields, and around 50% of these fields are optional, so they are often only (null) in my database. Can I do something so that the fields with no value are not shown?
The {tag} will just be removed when it's empty. In case you want to make some blocks disappear you can wrap that in a condition,
for example:
{#tags=null} {product_name}: {product_description} {/tags=null} {#tags!=null} {product_name}: {tags} {/tags!=null}
or if you have a value:
{#checked=="Yes"}☒Yes ☐No{/checked=="Yes"}{#checked!="Yes"} ☐Yes ☒No {/checked!="Yes"}
My second question would be the work with the print function and checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so that I only print the content of a selected checkbox ? It is not really working in the PL/SQL section.
Are you running the AOP Process type plugin or the Dynamic Action plugin?
For example we use it for ourself when selecting invoices and printing them.
We have a checkbox in an IR:
apex_item.checkbox2(
p_idx => 1,
p_value => id,
p_attributes => 'class="invoice_id"',
p_checked_values => :P39_INVOICE_ID_LIST,
p_checked_values_delimiter => ',') as chk,
And then we have a Dynamic Action on change that sets an hidden item (P39_INVOICE_ID_LIST) on the page:
var
//Checkbox that was changed
$checkBox = $(this.triggeringElement),
//DOM object for APEX Item that holds list.
apexItemIDList = apex.item(this.affectedElements.get(0)),
//Convert comma list into an array or blank array
//Note: Not sure about the "?" syntax see: http://www.talkapex.com/2009/07/javascript-if-else.html
ids = apexItemIDList.getValue().length === 0 ? [] : apexItemIDList.getValue().split(','),
//Index of current ID. If it's not in array, value will be -1
idIndex = ids.indexOf($checkBox.val())
;
//If box is checked and it doesn't already exist in list
if ($checkBox.is(':checked') && idIndex < 0) {
ids.push($checkBox.val());
}
//If box is unchecked and it exists in list
else if (!$checkBox.is(':checked') && idIndex >= 0){
ids.splice(idIndex, 1);
}
//Convert array back to comma delimited list
apexItemIDList.setValue(ids.join(','));
In our query in the AOP DA we have:
where i.id in (select regexp_substr(:P39_INVOICE_ID_LIST,'[^,]+', 1, level) invoice_id
from dual
connect by regexp_substr(:P39_INVOICE_ID_LIST, '[^,]+', 1, level) is not null)
and we make sure the P39_INVOICE_ID_LIST is set in session state by specifying the Affected Elements of the AOP plugin call.
If you setup an example of what you want to do on apex.oracle.com I'm happy to build you the example there. In AOP 4.0 we will also include an example with checkboxes.
Hope that helps,
Dimitri
I am calling an apex page via URL and pass all item values in the request like
f?p=&APP_ID.:44:&SESSION.:INSERT:&DEBUG.:44:P44_NAME,P44_DESCRIPTION,P44_PARENT_PK_ID:#NAME#,#DESCRIPTION#,#PARENT_PK_ID#_#PK_ID#
In my case I have to check if the row has a parent key reference value. If yes I have to set the parent key reference value to P44_PARENT_PK_ID. Otherwise, I have to set the key reference value (#PK_ID#) to P44_PARENT_PK_ID. That's why I am passing both values split with "_" in the URL.
On page 44 I have a process on the "Before Regions" process point:
DECLARE
v_demilitedstring varchar2(100);
BEGIN
v_demilitedstring := v('P44_PARENT_PK_ID');
IF nvl(to_number(substr(v_demilitedstring, 1, instr(v_demilitedstring, '_', 1, 1) -1)), 0) = 0 then
:P44_PARENT_PK_ID := substr(v_demilitedstring, instr(v_demilitedstring, '_', -1, 1) +1);
ELSE
:P44_PARENT_PK_ID := substr(v_demilitedstring, 1, instr(v_demilitedstring, '_', 1, 1) -1);
end if;
END;
I set the success message as &P44_PARENT_PK_ID. to check if the right value is assigned to it. The procedure is working fine and the correct value is set to P44_PARENT_PK_ID. However, the assigned value is not selected in select list (Meaning the display name of value is not displayed).
How can I trigger the select list item to change it's display value?
So it sounds like you have a select list generating correctly and you you want to change the value that is selected when the page loads. For that, go to the Source section of the select list item. You can drive that based on another page item, like P44_PARENT_PK_ID, a query, or a number of other options.
Make sure that the list of values for your select list will have the source value in it.
I want to hide a table and to report that "No Data" message is present if the query returns no data.
In computed columns i have added the columns which counts the number of rows present(i.e.TableCheck).
and i have created label just below the table with the message "No Data". In script onCreate i have added the below code.
if( countOfRows == 0 ){
this.getStyle().fontStyle = "italic";
this.getStyle().fontSize = "large";
}else{
this.text = "";
}
countOfRows = 0 is initialize in script.
In table visibilty propery, checked the Hide Element and added the below code in expression.
if (row["TableCheck"] == null){
true
}
else{
false
}
Problem: When dataSet is empty "No Data" Message is displaying.But when data set is not empty, then error message is not hiding.
Please let me know how to fix this.
Thanks in Advance.
Do it this way:
First add visual elements to display it when data set doesn't return any row.
Then define global variable in Initialize script of report root.
For example
rowsReturned = 0;
On your table that you'll evaluate data set to see is there rows returned on Visibility tab set next:
On elements you want to display whene there is no returned data set this on Visibility tab
If you want to hide the table when no data returned, you can write this in its Visibility property:
row.__rownum < 0
and in Visibility property of your "No Data" message you use the opposite check:
row.__rownum >= 0
Note that both components must be bound to the data set you want to check. In the case of the message component you can achieve this putting it in a header or footer row.
Alternative solution without using global variables (though functionally not quite the same, because the layout will always contain a table):
Add a binding numRows for the COUNT aggregate with the expression 1 to the table.
Set as visibility expression on the table header row:
!row["numRows"]
Add a new footer row to the table; for this footer row set the visibility expression
row["numRows"]
Merge the cells in this footer row, then place a label "No data found" into the table cell.