Data Warehousing Community Forum
February 09, 2012, 12:31:39 pm

Pages: [1]   Go Down
  Print  
Author Topic: User defined function- Scope Private  (Read 2854 times)
shankar.singu
DW Fresher
*

Reputation: +6/-0
Offline Offline

Posts: 16


View Profile
« on: May 26, 2010, 12:37:19 pm »

When I defined private scope for user defined function(UDF) (say function name fn_calcTax and scope private), it does not display in transformation user defined function list.

As I understood from the document that private (UDF fn_calcTax) can be used only in another user defined function (public function).

Is it correct? Then can you please give expression like how to call that private (fn_calcTax) function.

Example How I understood and testing .

Private Fn_calcTax(Salary decimal)  defined in designer and expression is
salary * 0.123

Public fn_calNetSalary(Salary decimal, Tax Decimal) Defined in Designer with Public scope and expression is

Salary – Tax

I utilized those function in expression transformation like

:UDF.CalNetSalary(salary, Fn_calcTax(salary))

The system gives wrong expression and it doest not able to identify that Private function.

Could you pls help me out on this? If possible please provide an example how to call private function in expression.

Regards,

Sankar. S
Logged
Whoever
Administrator
*****

Reputation: +34/-0
Offline Offline

Posts: 124



View Profile WWW
« Reply #1 on: May 27, 2010, 11:40:03 am »

Quote from: shankar.singu
As I understood from the document that private (UDF fn_calcTax) can be used only in another user defined function (public function).

Is it correct?
That is correct.

Quote from: shankar.singu
Then can you please give expression like how to call that private (fn_calcTax) function.

Example How I understood and testing .

Private Fn_calcTax(Salary decimal)  defined in designer and expression is
salary * 0.123

Public fn_calNetSalary(Salary decimal, Tax Decimal) Defined in Designer with Public scope and expression is

Salary – Tax

I utilized those function in expression transformation like

:UDF.CalNetSalary(salary, Fn_calcTax(salary))

The system gives wrong expression and it doest not able to identify that Private function.

Could you pls help me out on this? If possible please provide an example how to call private function in expression.
That is incorrect (My understanding).
You can't call the private function in an expression.

The only place you can use private functions is in the definition(s) of other function(s).

The example you gave, you're trying to use the private functions in the expression you use to invoke the public function.
You can't do that.

You can however, use Fn_calcTax in the definition of fn_calNetSalary -

Public fn_calNetSalary(Salary decimal) Defined in Designer with Public scope and expression is

Salary – Fn_calcTax(salary)



And you can always invoke it like so -

:UDF.CalNetSalary(salary)


disclaimer - I've been out of touch with Informatica for almost three years now, so the above can be a little rusty.
And all I've said above could be completely wrong.  Lips sealed
Logged

If most people said what’s on their minds, they’d be speechless.
shankar.singu
DW Fresher
*

Reputation: +6/-0
Offline Offline

Posts: 16


View Profile
« Reply #2 on: May 27, 2010, 12:15:22 pm »

Hi,
Public fn_calNetSalary(Salary decimal) Defined in Designer with Public scope and expression is

Salary – :UDF.Fn_calcTax(Salary)

:UDF.CalNetSalary(salary, Fn_calcTax(salary)) -- i was using earlier in PORT expression which is wrong.

Now slightly changed that expression and public function

:UDF.CalNetSalary(salary) -- i am using now in PORT expression only public function

And private function utilized in public function itself.

Public fn_calNetSalary(Salary decimal) Defined in Designer with Public scope and expression is

Salary – :UDF.Fn_calcTax(Salary) –it worked well   Kiss


Thanks a lot for your support and answer.

Regards,

Sankar. S
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: