New to Python. Here is the code thatwork in vb scripts. how to make it work in python
If [APPLICANT] = "UWNY" Then
Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Road_Permits_Suez_PDF_Scans\"+ [PERMIT_NO] +".pdf"
ElseIf [APPLICANT] = "O&R" Then
Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Road_Permits_OnR_PDF_Scans\"+ [PERMIT_NO] +".pdf"
Else
Attachment = "G:\highway_Permits\Road_Permits\Road Permits Issued\Roads_Permits_Others_PDF_Scans\"+ [PERMIT_NO] +".pdf"
End If
If you're new to Python, it's probably best if you do a bit to understand how it works before asking someone to convert your VB scripts.
The best way to learn (apart from reading the documentation) is to just start trying things out. I would suggest setting up Jupyter Notebooks or JupyterLab, as they are excellent for fiddling around and testing things out.
def some_func(arg0, arg1):
if arg0 = "UWNY":
out = f"path1\{arg1}\.pdf"
elif arg0 = "O&R":
out = f"path2\{arg1}\.pdf"
else:
out = f"path3\{arg1}\.pdf"
return out
# usage expression
# some_func(!first_field!, !second_field!)
change path1, path2 and path3 in the script to your long ones
Call it using a "code_block" with the expression, line 10, set up for a python parser substituting your field names in for those in the expression... don't omit the ! ! marks