Wednesday, February 28, 2024

*args to accept any number of positional arguments

 Consider the below case:

We need to all the sum all the inputs. Number of inputs are unknown.

sum(5,8,9)
The above will not work. sum() takes at most 2 arguments (3 given).

But, sum() can calculate the sum of Iterable i.e. means List, Tuple etc.

sum([5,8,9])
or
sum((5,8,9))
* means any number of arguments.
def sum_of_nums(*args):
print(args) -> o/p: (3, 8, 8, 190)
print(type(args)) -> <class 'tuple'>
return sum(args)


print(sum_of_nums(3, 8, 8, 190))

How to access Nested function from outside?

def func_a():
print('Task triggered for function A')

def func_b():
print('Task triggered for function B')

In this case, we cannot call func__b from outside. We can only access 
func_b() from inside of func_a().

def func_a():
print('Task triggered for function A')

def func_b():
print('Task triggered for function B')

func_b()
func_a()

To overcome this, we can return func_b as shown below:
def func_a():
print('Task triggered for function A')

def func_b():
print('Task triggered for function B')

# Notice, I am only providing the function name
return func_b


task_b = func_a()
task_b()

Wednesday, May 24, 2023

How to do filtering in XSLT

Filtering is a common requirement in most of the integration scenarios. Also, the condition for that can be dynamically changed based on the business requirement.



The above video explains -

  • How can we use parameters in XSLT
  • How to use tokenize function in XSLT

For complete XSLT demo video series, check out:

https://www.youtube.com/@btpintegration






Tuesday, May 23, 2023

XSLT Mapping in Cloud Integration - Video Series

XSL is a very powerful styling language. This is commonly used to do transformations from XML to XML or XML to HTML in SAP cloud integration.

Currently SAP Cloud Integration supports XSLT 3.0 capabilities.

The following video shows how to do grouping in XSLT.




Used XSLT element:  xsl:for-each-group

In this video, you will get to know:

1. How easily we can use VS extension to write XSLT
2. How we can use the same XSL file for XSLT mapping in Cloud Integration (CPI)

For complete XSLT demo series, check out:

https://www.youtube.com/@btpintegration/playlists





Saturday, October 10, 2020

Thursday, October 8, 2020