FizzBuzz in SAP CPI

FizzBuzz in SAP CPI (Time 0_00_00;22).png

In this post, you can see how it is possible to implement FizzBuzz in SAP CPI. It is by no way useful, the idea is to learn something about the SAP CPI. 

The idea is to count from 1 to 100. If the number is dividable by 3 then write Fizz, If dividable by 5 then write Buzz, and if dividable by both 3 and 5 then write FizzBuzz, otherwise write the name.

You can find tons of explanations in different languages. I wanted to see how SAP CPI works for this purpose. 

If you were to create this in SAP CPI you would go for creating it in Groovy script. It does not teach us as much about the platform. So I wanted to create it without any code. 

I have created a video of the result. 


 You can download the iFlow here FizzBuzz.zip.

 Conclusion

It is possible to create the flow in SAP CPI that calculates such things. 

I would love to be able to write some more powerful expressions and not having to create XML and then run Xpaths on the process. So some simple math would be useful. You don't have a lot of options in the Groovy expressions. 

Sure the context switching and create a Groovy script is probably the best approach. Then you have all the math capabilities you need and you don't have to write something in a limited language. 

 

1 comment