# Sepasoft SPC setCause - Error

**URL:** <https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158>\
**Category:** Ignition\
**Tags:** sepasoft, perspective\
**Created:** [February 2, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158 "2024-02-02T14:47:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [February 2, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/1 "2024-02-02T14:47:45Z")

</div>

Hi there,

I am using sepasoft SPC Module in Perspective. one issue I am facing is setting cause for a sample. If a sample fails then I would like QC to approve and provide notes which will be set as cause. I am using following script.

sampleUUID = '0000-000-0000-000000-00000'  
sample = system.mes.spc.sample.getSample(sampleUUID)  
cause = 'overfill'  
userName = 'test'  
attributeName = 'TestAttribute'  
system.mes.spc.sample.setCause(sample, attributeName, cause, userName)

In Logs, SPCManager is giving an error. **Error saving cause for sample.**

Am i doing anything wrong?

Please advise .Thanks

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [February 2, 2024, 4:06pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/2 "2024-02-02T16:06:49Z")

</div>

@Matrix_Engineering would you be able to direct someone to this post please? from sepasoft expert. Thanks

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [February 2, 2024, 4:19pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/3 "2024-02-02T16:19:20Z")

</div>

@jesse.records

I just searched this forum for "sepasoft" and found posts where the logo is in the user profile pic.

---

<div class="post-metadata">

**Author:** ![jesse.records](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse.records/32/10960_2.png) [@jesse.records](https://forum.inductiveautomation.com/u/jesse.records)\
**Post date:** [February 2, 2024, 6:19pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/4 "2024-02-02T18:19:27Z")

</div>

@Eagel007

Does that SampleUUID correlate to an existing sample in the system?

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [February 2, 2024, 8:18pm UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/5 "2024-02-02T20:18:29Z")

</div>

yes

---

<div class="post-metadata">

**Author:** ![jesse.records](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse.records/32/10960_2.png) [@jesse.records](https://forum.inductiveautomation.com/u/jesse.records)\
**Post date:** [February 3, 2024, 12:42am UTC](https://forum.inductiveautomation.com/t/sepasoft-spc-setcause-error/85158/6 "2024-02-03T00:42:25Z")

</div>

The format and value look odd to me.  
If you tried with the all zeros like your example you may have received an error like:

> java.lang.NullPointerException: java.lang.NullPointerException: Cannot invoke "com.sepasoft.production.spc.sample.CommonSample.getDefUUID()" because "sample" is null

If the sample is valid, you should be able to print type(sample) from the script console:

```auto
sampleUUID = '0000-000-0000-000000-00000'
sample = system.mes.spc.sample.getSample(sampleUUID)
print type(sample)

```

Output:

> \<type 'com.sepasoft.quality.common.core.Sample'\>
