# How to check a value of some text?

**URL:** <https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [January 24, 2024, 3:42pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706 "2024-01-24T15:42:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 24, 2024, 3:42pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/1 "2024-01-24T15:42:18Z")

</div>

i have a code linne which is :  
`call system.db.createSProcCall("Supervision_SelectCadencesInjection_100",event.source.parent.BDD_Statistique`  
I wanna know two things please.  
First where can I find System.DB.CreatSProcCall ? I looked in project browser and I didn't find it.  
the seconde thing : how can I know the value of event.source.parent.BDD\_Statistique  
thanks for ur help

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 24, 2024, 4:38pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/2 "2024-01-24T16:38:06Z")

</div>

> [@yahia\_alem](#):
>
> First where can I find System.DB.CreatSProcCall ? I looked in project browser and I didn't find it.

Any functions that start with `system` are provided by... the system 😄  
They should have some documentation attached to them if you autocomplete, e.g. with `Ctrl + Space`, and if you're on a reasonably new version of Ignition 8.1 you should also be able to simply hover over the call and get a description of the function and its parameters.

If you want the absolute best resource, though, then I would **highly** recommend bookmarking this page in our online manual: [System Functions - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/System+Functions)

> [@yahia\_alem](#):
>
> the seconde thing : how can I know the value of event.source.parent.BDD\_Statistique

You would log it or print it. I'm going to assume you're using Vision, and I'm also going to assume that the actual script looks like this:

```python
call = system.db.createSProcCall("Supervision_SelectCadencesInjection_100", event.source.parent.BDD_Statistique)

```

So to check the value of the parameter, just bind it to a separate variable and use the `print` statement (built in to Python 2.7) to log it. In your client or designer, you can then check the Diagnostics -\> Console tab from the menu bar. The reworked script should look something like this:

```python
db = event.source.parent.BDD_Statistique
print db
call = system.db.createSProcCall("Supervision_SelectCadencesInjection_100", db)

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 4:03am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/3 "2024-01-25T04:03:06Z")

</div>

If you want to find the `event.source.parent.BDD_Statistique` custom property in the designer, you will need to click on the container of that component. The `event.source` part of that code means the source of the event, or perhaps better stated, the component the event originated from. The `parent` part of that means the container the component is nested in. Finally, the `BDD_Statistique` part of that is the name of the property that lives on the parent container.

To see it, you will need to open the property editor pane:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/8/c86fcf32a3077ef60b235bb4e0c75cb5c052cedf.png)

The custom properties should be toward the bottom.

From your other post, it looks like you are working with version 7.9, so here is a link to the documentation on version 7.9 component properties:  
[docs.inductiveautomation.com/display/DOC79/Component+Properties](https://docs.inductiveautomation.com/display/DOC79/Component+Properties)

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 9:23am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/4 "2024-01-25T09:23:02Z")

</div>

hello,  
this is what I got when I deployed all propoerty editor !

![2024-01-25 10_19_07-VM_ITM_CASTETS - VMware Remote Console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2fb8f0893f21d6037aaa8050c8d79c6d68213c5.png)

when I double click on running I see this :

 ![2024-01-25 10_08_47-VM_ITM_CASTETS - VMware Remote Console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/2/b2e224872e148bfff1cdf116db25ea6109efb089.png)

What I understand is that the BDD\_Statistique can be one of the two values ITM\_Castets or ITM\_Stats . The quesion is there an option to ignore the seconde Database ? without touching the code ?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 9:55am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/5 "2024-01-25T09:55:45Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f8318c0b3739290f9c292160a7825a9ac626c7f5.png)  
The timer is the scripted component itself. The custom property is on the parent container it is nested in.

> [@justinedwards.jle](#):
>
> The `parent` part of that means the container the component is nested in.

> [@yahia\_alem](#):
>
> The quesion is there an option to ignore the seconde Database ? without touching the code ?

I'm not sure. Both of the code examples @bkarabinchak.psi and myself provided in the other post would essentially ignore the faulted database until it is fixed and will start working as it did before once it's repaired. Messing with the bindings could prevent the normal application behavior from resuming when and if the database connection is ever restored.

I can't tell what this timer actually does, so I don't know how important this function is to your customer's operation. Therefore, I can't advise you to permanently disable the database read.

I suspect the correct solution is to leave everything as it is, and fix the database.

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:06am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/6 "2024-01-25T10:06:53Z")

</div>

sorry but something is wrong in this code  
and I dont see where Dbstatut get the value Valid !!!!

 ![2024-01-25 11_06_38-VM_ITM_CASTETS - VMware Remote Console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/6/46fb92e671a7aab677a30acae1be331a89022234.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 10:17am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/7 "2024-01-25T10:17:26Z")

</div>

The problem is the indention:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/8/c8bfc529378976ddd8fb6cc0186a3f6109fb882c.png)

This happens sometimes when pasting code. Notice how in my code example the `if` is aligned with `dbStatus`?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/860f892f1dd3b840058d4ddec71aa4c815f70aa0.png)

In Python, the indentions have to be correct.

> [@yahia\_alem](#):
>
> I dont see where Dbstatut get the value Valid

Here is the documentation on system.db.getConnectionInfo:  
[docs.inductiveautomation.com/display/DOC79/system.db.getConnectionInfo](https://docs.inductiveautomation.com/display/DOC79/system.db.getConnectionInfo)

It returns a dataset that has a column called status. If the database is working, the status will be 'Valid'. I also added a check to make sure data is returned in case one of the variable names for some reason doesn't match any of the database names.

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:26am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/8 "2024-01-25T10:26:17Z")

</div>

thank u ! But I still get the pop up 🥲 🥲 🥲

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 10:27am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/9 "2024-01-25T10:27:04Z")

</div>

That's surprising. It's the error message the same?

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:28am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/10 "2024-01-25T10:28:15Z")

</div>

yes it is the same

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:28am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/11 "2024-01-25T10:28:56Z")

</div>

```auto
if event.propertyName == "value":
# Get the connection info for the given database name
	dbConnectionInfo = system.db.getConnectionInfo(event.source.parent.BDD_Statistique)

	# If the database name returns any information, get the status value from the status column, else flag the result as invalid
	dbStatus = dbConnectionInfo.getValueAt(0, 'Status') if dbConnectionInfo.rowCount else 'inValid'

	# If the database connection status is valid (not faulted) continue with the code, else abort and quietly log the problem
	if dbStatus == 'Valid':
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectCadencesInjection_100",event.source.parent.BDD_Statistique)
		# Ajout du paramètre
		#call.registerInParam('System', system.db.INTEGER, 1)
		
		# Excecution de la procédure
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.LigneDataset = result
		
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectTauxSaturationPlateaux_100",event.source.parent.BDD_Statistique)
		# Excecution de la procédure	  
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.SaturationDataset = result
		
		
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectTopCinqSaturation_100",event.source.parent.BDD_Statistique)
		# Excecution de la procédure	  
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.OperateurDataset = result
		
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectRebuts_100",event.source.parent.BDD_Statistique)
		# Excecution de la procédure	  
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.RebutDataset = result

```

````
  ```

````

type or paste code here

```auto

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 10:35am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/12 "2024-01-25T10:35:15Z")

</div>

I'm out of ideas then. Did bkarabinchak.psi's suggestion work?

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:39am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/13 "2024-01-25T10:39:58Z")

</div>

I'm gonna try it now but I donc understand his solution ! can u explain it to me please?  
talking about this line  
 ![2024-01-25 11_39_21-Pop up always appears - Ignition - Inductive Automation Forum et 23 pages de plu](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef6e3db13c9c8167d3be136158cf4aa24fdcbd2d.png)

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 10:43am UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/14 "2024-01-25T10:43:55Z")

</div>

tried it, but still doesn't work

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 25, 2024, 12:42pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/15 "2024-01-25T12:42:14Z")

</div>

The error you were getting in your other post if you note you can see it says `java.lang.Exception` - this is a subclass of `java.lang.Throwable` so when you do a `try/except` if offers you the programmer a chance to do something with that error.

This part

```auto
except java.lang.Throwable, e:
    print e

```

would only print the error to your console. If you don't handle the error like this, then Vision gives you that popup you were seeing.

I am surprised it did not work. Did you start with a `try`? It will not work unless both `try` and `except` are present. You `try` do your code and then if there is an exception(error) - do this instead. Post your full code, I am surprised it would not work. Please use the formatting instead of a picture.

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 12:51pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/16 "2024-01-25T12:51:47Z")

</div>

Hi this is what I wrote :

```auto
import java.lang.Throwable # SQL errors come through as java
if event.propertyName == "value":
    try:
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectCadencesInjection_100",event.source.parent.BDD_Statistique)
		# Ajout du paramètre
		#call.registerInParam('System', system.db.INTEGER, 1)
			
		# Excecution de la procédure
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.LigneDataset = result
			
		# Appel de la procédure stockée
		call = system.db.createSProcCall("Supervision_SelectTauxSaturationPlateaux_100",event.source.parent.BDD_Statistique)
		# Excecution de la procédure	  
		system.db.execSProcCall(call)
		# Copie des résultats dans un dataset
		result = call.getResultSet()
		if result.rowCount > 0:
			event.source.parent.SaturationDataset = result`Preformatted text`
    except java.lang.Throwable, e:
        # Now the popup won't appear, you probably want to log this somehwere though
        print e

```

exacly as U wrote it in the other post

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 25, 2024, 1:09pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/17 "2024-01-25T13:09:55Z")

</div>

And what happens? You are still getting the pop up error after you save and publish this change to the client?

If so can you click on the "details" part of the error popup copy and paste the stack trace here

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 1:19pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/18 "2024-01-25T13:19:06Z")

</div>

It just occurred to me what could be happening. When I first started scripting in Ignition, I would open the script console in windows, and it would open narrow, so the "Apply" button wasn't visible. Consequently, I would forget about pressing it, and my code changes would have no effect.

Both of our scripts should have changed the outcome, so I'm wondering if this the case, and the apply button has simply not been pressed to apply the code change.

Try widening your scripting window to see if the apply button becomes visible. The code changes won't take effect unless that button is pressed.

---

<div class="post-metadata">

**Author:** ![yahia\_alem](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yahia\_alem](https://forum.inductiveautomation.com/u/yahia_alem)\
**Post date:** [January 25, 2024, 1:20pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/19 "2024-01-25T13:20:24Z")

</div>

Traceback (most recent call last):  
File "event:propertyChange", line 8, in

java.lang.Exception: java.lang.Exception: Error executing system.db.execSProcCall()

```
caused by Exception: Error executing system.db.execSProcCall()
caused by GatewayException: The database connection 'ITM_STATS' is disabled.
caused by DisabledDatabaseConnectionException: The database connection 'ITM_STATS' is disabled.

```

Ignition v7.9.3 (b2017060210)  
Java: Oracle Corporation 1.8.0\_191

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 1:23pm UTC](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706/20 "2024-01-25T13:23:06Z")

</div>

The line number is even the same, so it really does seem like the changes haven't been applied. Please confirm that you've ordered the apply button on the bottom right side of the script window.

[Next page](https://forum.inductiveautomation.com/t/how-to-check-a-value-of-some-text/84706.md?page=2)
