Skip to main content
added 224 characters in body
Source Link
Midavalo
  • 29.9k
  • 11
  • 51
  • 105

Take the two % out of this line if '%Notes_SHLs%' in layer.dataSource:

If you want to check if a specific string is within a variable, you need to exclude the % wildcard symbols

if 'Notes_SHLs' in layer.dataSource:

In response to your comment below, do a print on that layer.dataSource rather than the if to determine what is actually there:

if layer.supports("DATASOURCE"):
    print layer.dataSource

Take the two % out of this line if '%Notes_SHLs%' in layer.dataSource:

If you want to check if a specific string is within a variable, you need to exclude the % wildcard symbols

if 'Notes_SHLs' in layer.dataSource:

Take the two % out of this line if '%Notes_SHLs%' in layer.dataSource:

If you want to check if a specific string is within a variable, you need to exclude the % wildcard symbols

if 'Notes_SHLs' in layer.dataSource:

In response to your comment below, do a print on that layer.dataSource rather than the if to determine what is actually there:

if layer.supports("DATASOURCE"):
    print layer.dataSource
Source Link
Midavalo
  • 29.9k
  • 11
  • 51
  • 105

Take the two % out of this line if '%Notes_SHLs%' in layer.dataSource:

If you want to check if a specific string is within a variable, you need to exclude the % wildcard symbols

if 'Notes_SHLs' in layer.dataSource: