How to change List Item value on WHEN_VALIDATE_ITEM - oracle

I am working on Forms 6i on a very old software.
There is a requirement to add 3 List Item (Combo Box) to the form.
If the value in List Item X is changed, then upon WHEN_VALIDATE_ITEM, I need to change the value on List Item Y.
Here is the code but it's not working.
BEGIN
IF :PIH.TEXT_ITEM1544='Book' THEN
Copy('Own Use',Name_In('PIH.TEXT_ITEM1546'));
END IF;
END;
There are no errors in compilation, but I believe that when I select the value Book and press enter or tab and go to another field, nothing is triggered.
Any help would be really appreciable.

What do you want to do exactly? If you want to assign the value 'Own Use' to the item PIH.TEXT_ITEM1546 you can do it with:
:PIH.TEXT_ITEM1546 := 'Own Use';
Or with:
Copy('Own Use','PIH.TEXT_ITEM1546')
The statement you're using:
Copy('Own Use',Name_In('PIH.TEXT_ITEM1546'));
is trying to copy the value 'Own Use' to the item referenced by PIH.TEXT_ITEM1546, i.e., it's trying to copy the value to an item named as the value stored in the item PIH.TEXT_ITEM1546.
The Name_In function gets the value of the specified item.

Related

how to promt a message if a field is empty in oracle forms

How to prompt a message if field is empty in oracle forms i'm not sure if it works and the trigger i'm using is when-validate-item
begin
if date = NULL then
message('please enter issue date')
else
null;
end if;
end;
From my point of view:
you should edit field's properties and set the required property to yes and let Forms worry about it
if you insist on reinventing the wheel, then don't just display a message as it is pretty much useless - user can ignore it. Raise an error, instead
if :block_name.item_name is null then
message('Please, enter issue date');
raise_form_trigger_failure;
end if;
Put that piece of code into the WHEN-VALIDATE-ITEM trigger.
Just modify the code a little bit as
converting date = NULL to :date IS NULL, since : prepended to
the field's name within the code
add an extra message(''); (exactly this with blank padded
argument) if a pop-up message box needed
don't forget the semicolon at the end of the line of the current
message(....)
as invoking from one of the WHEN-VALIDATE-ITEM or WHEN-NEW-ITEM-INSTANCE triggers

Apex Link builder value - item not displayed on the target page

I LOAD P70_NODE_ID from Javascript.
APEX 20.2
then run the following:
apex_util.set_session_state('P70_NODE_ID_OUT', :P70_NODE_ID);
When I show the session I see P70_NODE_ID_OUT and P70_NODE_ID. They both have the correct values
link to another page using the link builder
under item and value:
item P80_STEP_ID value :P70_NODE_ID_OUT
display p80_STEP_ID
I never see a value.
NOTE: The target page is a modal dialog built with the form wizard.
I have tried using a where statement P80_STEP_ID = :P70_NODE_ID_OUT
Still I don't see a value.
Is the problem related to inserting a value from Javascript?
How do I work around this?
Thanks
It turns out that when using redirect to another page in the same application, it uses the values that exist when the page is built and never looks at the values again. As a result, when values change after a page is loaded, the new values aren't used. The following allows you to use changed values when redirecting.
Used advice from the Apex community. This is what worked for me.
This uses apex_page.get_url and the technique you suggested. Tested good.
Javascript that runs when a node is selected in a flowchart:
$s('P72_NODE_ID', tagNum);
$s('P72_NODE_TYPE', selNode.getShape().getId());
$.event.trigger('submitNodeSel');
DynamicEvent
WHEN
event: custom
custom event: submitNodeSel
selectionType: javascriptexpression
javascript expression: document
True Action
Action: set value
set type: PL/SQL Function Body
DECLARE
STEP_DETAIL_URL varchar2(2000);
l_app number := v('APP_ID');
l_session number := v('APP_SESSION');
BEGIN
STEP_DETAIL_URL := apex_page.get_url(
p_page => '80'
, p_items => 'p80_step_id,p80_node_type'
, p_values => :p72_node_id || ',' || :p72_node_type
, p_plain_url => true);
RETURN STEP_DETAIL_URL;
END;
input: p72_node_id,p72_node_type
affected Elements
selection type: item(s)
item(s): P72_STEP_DETAIL_URL
BUTTON
Dynamic Action
execute javascript code
True Action
Javascript
makeDialogUrl( $v("P72_STEP_DETAIL_URL"));
Javascript Code
function makeDialogUrl (url) {
var i;
// replace unicode escapes
url = url.replace(/\\u(\d\d\d\d)/g, function(m,d) {
return String.fromCharCode(parseInt(d, 16));
});
apex.navigation.dialog(url,
{title:'Dialog In
Out',height:'auto',width:'720',maxWidth:'960',modal:true,dialog:null},
"t-Dialog-page--standard", "#STEP_DETAILS");
}
2 should be
under item and value: item P80_STEP_ID value &P70_NODE_ID_OUT.
Note leading ampersand & and trailing dot .
BTW, Apex would have done it for you if you picked columns from the LoV.

ngModel - delete last character

i am using mat-radio-group to bind my data. here data & value are same. which means i have 4 value binded and all 4 value are same. So to differentiate the radio buttons i added index as last value for every radio button.
Now i want to fetch this radio button value into my typescript and also eliminate the lastcharacter(which is index). so i use ngModel & ngModelChange.
I can get the output. but the `mat-radio-button' is not selecting
Here is my code
`
<mat-radio-group class="radioButtonAxis" [(ngModel)]="ngM_Fax" (ngModelChange)="onFaxChange($event)">
<mat-radio-button *ngFor='let data of resultSet;index as i' [value]='data.Fax+i'>{{data.Fax}}</mat-radio-button>
</mat-radio-group>
onFaxChange(value){
this.ngM_Fax = value.substring(0, value.length - 1);
}
`
expecting your help on this.
You are using ngModel wrong. The right value is always in this.ngM_Fax, but it has to match 100% [value]. If you want to use the variable without the index, i would suggest to use an extra variable.
Here is a working StackBlitz.

How to set variable values to specific cell or element in BIRT

I have declared variable in beforeFactory of BIRT Report.
For example:
This variable I am incrementing in table row render like:
Now when all the rows are rendered I want to set above variable to specific cell/ element. I tried
document.getElementName("numberOfMobilityFilesProcessed").text = numberOfMobilityFiles;
AND
reportContext.getDesignHandle().getElementByID
but they are not working out for me.
I had some problems with temporaly local variables used at multiple steps of datasource scripting so I always used global persisting.
After changing your variable you convert it to a String (because only Strings can be persisted) and before editing your variable again, you load the String from persisted context and convert it to the type you want (String to Integer are automatically converted by JavaScripts dynamic typed variables, but don't forget the toString() when you are saving otherwise you will risk an error).
Because you are using reportContext.setPersistentGlobalVariable your variable is accessable in every Element of your Report.
Example:
var rowNum = reportContext.getPersistentGlobalVariable("row_number");
if(rowNum == null){
rowNum = -1;
}
rowNum++;
reportContext.setPersistentGlobalVariable("row_number", rowNum.toString());
Ok, you have a text element displaying a number of row in a table element. The text element appears before the table in the report.
If you are using two separate tasks RunTask and RenderTask:
Add a report variable in your report (see "variable" node on the Data Explorer view). Then you can change the report variable in onCreate() event handler of the table row:
vars["numberOfSomething"] = vars["numberOfSomething"] + 1;
and access its value in an onRender() evenet handler of some text element, for instance DynamicText:
this.text = "Number of something: " + vars["numberOfSomething"];
If you are using RunAndRenderTask, you must look for another approach. In this case an order of onCreate() and onRender() calls is different. You could bind the same DataSet to the text element displaying the counter, as the one bound to the table. Than you can add an aggregation binding to the text element that will count all rows in the dataset.

How do I reset a KendoDropDownList selected index back to -1 (nothing selected)

When a KendoDropDownList is created it's initial index is set to -1 and the text is empty.
IE: $("#txtQPLPickupFrom").data("kendoDropDownList").select() would return a -1.
When a selection is made, the select() returns the selected index (0,1,2,3...).
My question is, I want to return the selected index back to -1 when I am displaying an new record entry where the user has not selected a value. Trying to use .select(-1) does not seem to work. So it there a way to restore the initial selection to nothing (-1) after it's already had a value.
This should work:
$("#txtQPLPickupFrom").data("kendoDropDownList").value(-1);
Here is a fiddle (not mine): http://jsfiddle.net/EaNm4/124/
The kendo dropdown will always default to the first item in its datasource. You could configure the dropdown to use optionLabel: ' ' (a space), which will cause the initial value selected to have no text.
You could then reset the selection to this value with .select(0).
This seems to work: (I have to do more testing)
var txtQPLPickupFrom = $("#txtQPLPickupFrom").data("kendoDropDownList");
txtQPLPickupFrom.text(txtQPLPickupFrom.options.optionLabel);
txtQPLPickupFrom.element.val("");
txtQPLPickupFrom.selectedIndex = -1;
This worked for me:
$("#Actions").data("kendoDropDownList").refresh();
use txtQPLPickupFrom.value(-1)
txtQPLPickupFrom.value(-1);
this should set it to empty

Resources