cancel
Showing results for 
Search instead for 
Did you mean: 

'FixValues' function question

Former Member
0 Kudos

Hey everyone!

I'm looking for a way to create an array function in XI.

For instance, I have a 'FixValues' function defined, which I want to map to multiple 'FixValues' depending on the output of the Main 'FixValues' function:

For example,

Main 'FixValues'

01 : AA

02 : BB

03 : CC

then, IF

Main = 'AA'

001 : XYZ

002 : WER

003 : KLM

Main = 'BB'

001 : UIO

002 : POI

003 : JHG

Main = 'CC'

001 : WED

002 : THU

003 : FRI

Would anyone know how to make this possible?

Thanks in advance!

Glenn

Accepted Solutions (1)

Accepted Solutions (1)

vijay_b4
Active Contributor
0 Kudos

Hi Glenn,

From

JavaDoc:

getFunction

public JCO.Function getFunction()

Creates a function object from the template and returns it

Returns:

the function created from the template

So, you can reuse function template to create multiple fuctions.

or

work around with an ArrayList to put multiple functions in it.

Then pass an Object[] got from toArray method of arraylist to my helper execute call.

Then loop and cast each Object back to Function and then execute it.

Reward points if this helps

Regards

Pragathi.

Former Member
0 Kudos

Hello Pragathi,

I'm so sorry I didn't quite understand your reply. Would it be allright to explain it further?

Thanks!

Glenn

Former Member
0 Kudos

Hi,

maybe it's also possible to concat the 2 input values and then use one Fix Value function.

Example:

01001 --> XYZ

02003 --> KLM

...

Depends from your input values if this is feasible.

Regards

Patrick

Former Member
0 Kudos

Hey Patrick!

You're a genius! Thanks for suggesting the 'concat' solution. If you could share the UDF I could use - since I'm not too good at Java - it'd be really awesome!

Cheers!

Glenn

Former Member
0 Kudos

Hi,

a UDF could look like this:

public String valueMapping(String firstValue,String secondValue,Container container){

if(firstValue.equals("AA")) {

if(secondValue.equals("001")) return "XYZ";

if(secondValue.equals("002")) return "WER";

if(secondValue.equals("003")) return "KLM";

}

if(firstValue.equals("BB")) {

if(secondValue.equals("001")) return "UIO";

if(secondValue.equals("002")) return "POI";

if(secondValue.equals("003")) return "JHG";

}

if(firstValue.equals("CC)) {

if(secondValue.equals("001")) return "WED";

if(secondValue.equals("002")) return "THU";

if(secondValue.equals("003")) return "FRI";

}

//default value

return "";

}

Regards

Patrick

Answers (7)

Answers (7)

Former Member
0 Kudos

HI Glenn,

As per patrick you can hardcode the concatenated values(as input ) in fix values table...

There is no need of concatenate function separately...

Glenn, please correct me if wrong.

Regards,

Former Member
0 Kudos

Hi Santosh!

Yup, I understand that you can solve the problem using the FixValues solution alone; I was just wondering if anyone could share me the UDF code as an alternative. Thanks for your reply anyway!

Glenn

Former Member
0 Kudos

Hello everyone,

Thanks for all your suggestions!

I've thought about using IF conditions together with the FixValue function, however, I will have 78 entries in the main FixValue function so this may not be a practical approach.

I'll try your other suggestions and award points after my testing. in the meantime, please feel free to provide more solutions.

Many, many thanks!

Glenn

Former Member
0 Kudos

Hi,

> I will have 78 entries in the main FixValue function

In this case I would use Fix Value for the main value but you should use a numeric value as output.

Then write a UDF with a switch condition for each possible input.

Regards

Patrick

aashish_sinha
Active Contributor
0 Kudos

Hi,

In my opinion, writing UDF will be the best case as depending upon the main values you need to populated the things to resultset. This is simplest in my opinion and it will help when you pass n number of entry in ur actual file.

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hi,

U can write the UDF to solve this problem.

If( main==00)

{

assign values;

}

else if(main==01)

{

Assign values;

}

Reward points if helpful.

Regards,

Soumya

vijay_b4
Active Contributor
0 Kudos

Hi Glenn,

Please reward points if it helps

Former Member
0 Kudos

Hi,

you could use 4 Fix Value functions.

First one is used for your main value.

Then you can check the output with equalsS and pass the result to an if function and use one of the 3 other Fix Value functions.

Regards

Patrick

former_member208856
Active Contributor
0 Kudos

hi,

you can use Boolean functions (IF with Else and IF without Else) for the same.

For comparing the value of Main use Text Function (equalsS) for the same.

use IF without Else :

In Equals pass two values 1. Value of Main

2. Constant (AA)

In Then Pass fix values of you requirement.

Extend this condition with using other if with else.

Regards,

Sandeep Kaushik

Former Member
0 Kudos

Glenn,

You mean to say you need to maintain 3 sets of values instead of usual 2 sets(key and value), if so upto my knowledge you can not use Fix Values to achieve this. Use tables in R/3 and create a RFC lookup to chieve this requirement.

Regards,

Jaishankar