cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hyproxious
Regular Visitor

Python script not giving an output

Using the python script below, I'm trying to just increase the dep count by 1 but ignore the section ID. When I test this code elsewhere, it works great. However, when I run it in PAD the PythonScriptOutput doesn't change and stays as an empty string.

 

Any help would be greatly appreciated.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
PhilipTreacy
Resolver I
Resolver I

Hi @Hyproxious 

 

Further to this, the PAD vars are brought into Python as strings so you need to cast N to int.

 

The following code works for me

SO = """%SO%"""
N = int("""%N%""")
x = SO.split(str(N), 1)
N += 1
x.insert(1,str(N))
P = ''.join(x)
print (P)

 

regards

 

Phil

View solution in original post

3 REPLIES 3
PhilipTreacy
Resolver I
Resolver I

Hi @Hyproxious 

 

To access a PAD variable you need to wrap it in 3 x double quotes e.g.

 

SO = """%SO%"""

 

Also the print function requires () e.g. print(x)

 

regards

 

Phil

PhilipTreacy
Resolver I
Resolver I

Hi @Hyproxious 

 

Further to this, the PAD vars are brought into Python as strings so you need to cast N to int.

 

The following code works for me

SO = """%SO%"""
N = int("""%N%""")
x = SO.split(str(N), 1)
N += 1
x.insert(1,str(N))
P = ''.join(x)
print (P)

 

regards

 

Phil

Hyproxious, 

Fully agreed with all instructions from Phil.

One amendment is you can use a double quote on both sides to access PAD variables.

 

Eg;  x = "%SO%"

 

VJR_0-1658896500479.png

 

Output of x shows up in the PythonScriptOutput variable

 

VJR_1-1658896537261.png

 

 

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Top Solution Authors
Users online (1,724)