cancel
Showing results for 
Search instead for 
Did you mean: 

Variable for "x" amount of numbers

former_member728809
Discoverer
0 Kudos

I'm trying to create a variable that will say If "Vendor (number)" has 6 digits then it will return "Internal - otherwise it will return "External" Like in excel this would be an easy "If" statement - but in BO should I use "count" or something else altogether.

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're new in asking questions here, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members. For example, you can outline what steps you took to find answers (and why they weren't helpful), share screenshots of what you've seen/done, make sure you've applied the appropriate tags, and use a more descriptive subject line. The more details you provide, the more likely it is that members will be able to assist you. You should also make sure you're using all the appropriate tags, so the right experts can find your question.

Should you wish, you can revise your question now by selecting Actions, then Edit.

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS . By personalizing your profile with a photo of you, you encourage readers to respond.

Best regards

Jennifer

SAP Community moderator

Accepted Solutions (1)

Accepted Solutions (1)

ayman_salem
Active Contributor

Define your variable as follows:

Status: =If Length(""+[Vendor Number]) = 7 Then "Internal" Else "External"

(Note: We add an additional "" at the beginning to convert the number into a string, so =6 will be =7)

...

Hope this gives you some idea on how to solve your needs

Answers (1)

Answers (1)

former_member728809
Discoverer
0 Kudos

Thank you so much for your quick reply and help!!! Now one follow up questions 😉

in my Vendor column - all the vendors have 10 digits (internal have 4 leading 0's and external have 3 leading 0's). I know i can use "Right" command to get rid of the leading 0's - but can I do that without cutting off one number of the external vendor - or adding a "0" to an internal vendor?

As you can see in the screenshot below - the highlighted rows are external (7 numbers) - so how can i make these show without the leading 0's?

ayman_salem
Active Contributor
0 Kudos

Where is the screenshot?

anyway,

Change the variable to:

=If Length(""+ToNumber([Vendor Number])) = 7 Then "Internal" Else "External"