 Former Member

# APO macro as excel function =LEFT or =RIGHT

Hi all,

in demand planning process I am using a customer specific characteristic which is a string of several numbers.

By one specific digit out of this string it has to be differentiated whether calculation logic A or B has to be executed.

Example:

9 9 9 1 9 9 --> calculation A

8 8 8 1 8 8 --> calculation A

9 9 9 2 9 9 --> calculation B

8 8 8 2 8 8 --> calculation B

Is there any macro functionality like the excel function "=left" or something else which can return the value of this string's certain digit of the actual selected CVC?

By the way, I don't want to solve this by creating an additional characteristic/attribute oder changing the CVC structure...

Any help would be highly appreciated!

Julian

10|10000 characters needed characters exceeded

### Related questions Former Member
Posted on Sep 07, 2009 at 01:54 PM

Julian,

Try this:

Suppose you are storing the valkues in Characteristic "CHARA". You want to decide upon the use of "Alternative 1"

or "Alternative 2" based on whether the FOURTH digit in "CHARA" is "1" or "2".

So IF:

8 8 8 1 8 8 --> Alternative 1

9 9 9 2 9 9 --> Alternative 2

Use the follwoing logic:

SET Layout Variable "VAR" = ACT_IOBJNM_VALUE("CHARA")

IF {DIV ( FRAC( VAR/1000 ) / 100 )} = 1

USE Alternative 1

ELSEIF {DIV ( FRAC( VAR/1000 ) / 100 )} = 2

USE Alternative 2

EX: for 888188

DIV ( FRAC( 888188/1000 ) / 100 )

= DIV ( 188 / 100 )

= 1

I think this might just work. My only doubt is if the variable VAR will be treated as a char string, thus not allowing

any arithematic manipulations...

Let me know if this helps.

Regards,

Abhi

10|10000 characters needed characters exceeded
• Former Member

Hi Abhi,

After testing I can confirm that it is possible to store the numeric value of a characteristic as a number in a layoutvariable :

Macro syntax as an example:

action box: set LV

LAYOUTVARIABLE_SET( 'LV' ; ACT_IOBJNM_VALUE( 'ZZZZ' ) )

Important: If you use 'ACT_IOBJNM_VALUE( 'ZZZZ' )' (->with ' ) the system can't work with this as it interprets this as a text string.

The rest should be clear...

Julian