Showing posts with label Number. Show all posts
Showing posts with label Number. Show all posts

06 December, 2016

OAF : Number Format

In OAF, There is not format expression in BC4J like ADF, So you do formatting using controller classes.

There are 2 ways to format numbers in OAF
  
1- Format Numbers
Write this code  in processRequest method

import oracle.cabo.ui.validate.Formatter;

        Formatter formatter =
            new OADecimalValidater("###,###,##0.00", "###,###,##0.00");
        OAWebBean numericBean = webBean.findChildRecursive("<>");
        if (numericBean != null)
            numericBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);


2- Format Number using currency format

Write this code  in processRequest method
        OAWebBean currencyBean = webBean.findChildRecursive("<>");
        if (currencyBean != null)
            currencyBean .setAttributeValue(CURRENCY_CODE, "USD");


Thanks

01 August, 2011

Get sequence next value in ADF


I will present how to use ADF BC to get next value of sequence.

1- Creating Method 

We can create generic method that I will pass to it sequence name and it will return next value.


As we noticed in previous code that I use SequenceImpl to get sequence value.

11 July, 2011

How to get numbers that its summation is equal to specific result

SA,
Today I will present plsql function that return all available numbers that its summation is equal to specific result with condition that numbers formed of specific count of  digits.

Prerequisites
We will create collection (table of varchar2) to be as output result of function
/*****************************************************************
/*   That type will output of function[table of varchar2]
/****************************************************************/

CREATE OR REPLACE TYPE varchar2_nt AS TABLE OF VARCHAR2 (30);

Function Code
/****************************************************************
/*author           : Mahmoud Ahmed El-sayed
/*Email            : mahmoud_ahmed01@yahoo.com
/*creation date    : 10/07/2011
/*Function Purpose : That function used to get the number from n digit that its
/*                   addition is equal to the input result
/*$parameters      :
/*         in_result      ==> Summation of numbers
/*         in_digit_count ==> count digit
/****************************************************************/

CREATE OR REPLACE FUNCTION sum_digit (
   in_result        NUMBER,
   in_digit_count   PLS_INTEGER
)
   RETURN varchar2_nt
IS
   ret_value   varchar2_nt;
BEGIN
   SELECT numbers.RESULT
   BULK COLLECT INTO ret_value
     FROM (SELECT     LTRIM (SYS_CONNECT_BY_PATH (num, '+'),
                             '+'
                            ) addition_equation,
                      REPLACE (SYS_CONNECT_BY_PATH (num, '.'), '.') RESULT
                 FROM (SELECT     LEVEL - 1 num
                             FROM DUAL
                       CONNECT BY LEVEL <= 10)
                WHERE LEVEL = in_digit_count
           CONNECT BY LEVEL <= in_digit_count) numbers
    WHERE dbms_aw.eval_number (numbers.addition_equation) = in_result;

   RETURN ret_value;
END;

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...