# Variables dont produce the expected result

**URL:** https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307
**Category:** Discussion
**Created:** [May 27, 2008, 12:57pm UTC](https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307 "2008-05-27T12:57:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 27, 2008, 12:57pm UTC](https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307/1 "2008-05-27T12:57:59Z")

</div>

Hi, over the last week, every time I run my automise task i am not getting the result i want for the task. I have discovered one error so far attached below. Can someone pelase assist me in fixing this issue?&nbsp; I am very new to automise and have tried to resolve this problem without success.&nbsp;

I am expecting with the output of&nbsp; "filename%ImportYear%%ImportMonth%-%ImportDay%.ZIP" fails with an incorrect filename of "filename--.ZIP", instead of filename0802-01 for example. It used to work for a long time until a week ago.

I suspect that the error below is resulting in the incorrect filename.

Please assist. Thanks.

Richard

&nbsp;

| Status | Action Name | Description | Start Time | End Time | Run Time | Output  
 [script removed] [script removed] |
| --- | --- | --- | --- | --- | --- | --- |
| - | Action List | Action List: Main | 08:08:38 | 08:08:39 | 00:00:00 |
| Completed | Action Group | Set Variables | 08:08:38 | 08:08:38 | 00:00:00 |
| Completed | Define Variable | Define Variable | 08:08:38 | 08:08:38 | 00:00:00 | [script removed] |
| 

```
Warning: Variable ImportPreviousMonth is already defined.Setting default to "1"
```

 |
| Error | Set Variable | Set Variable ImportPreviousMonth to Deincrement[] | 08:08:39 | 08:08:39 | 00:00:00 | [script removed] |
| 

```
Unable to Set Variable : ImportPreviousMonth to : %ImportMonth%'' is not a valid integer value
```

 |
| - | Action List | Action List: OnFailure | 08:08:39 | 08:08:39 | 00:00:00 |
| Completed | Export Log | Export Log [\\pancho\common\Technical\Automise Projects\Logs\ProviderImportLog.html] | 08:08:39 | 08:08:39 | 00:00:00 |

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 27, 2008, 1:05am UTC](https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307/2 "2008-05-27T01:05:12Z")

</div>

Hi Richard,   
  
Thanks for posting, sorry for the inconvenience you're experiencing. I think I can partially clarify the problems that you are having.   
  
The "Define Variable" action is not a recommended solution for variables - it's a "For Use in Emergencies Only" action. The next version of Automise will have a warning on this action, giving a message to this effect.   
  
The recommended way to work with variables is:   
  
1) Remove all Define Variable actions.   
  
2) Choose "Edit Variables" from the Tools menu. A dialog will open. You will probably see that all of the variables that you were using Define Variable for already exist, because the project was saved at some point after the actions ran. This is what would have caused the above project to fail.   
  
3) Double-click each variable to edit it, and set the correct default value. The default value is the value that the variable will have when your Automise project first starts running.   
  
Please let us know if that fixes the problem. If you're still having problems, could you please let us know what version of Automise you are using? Thanks.   
  
Regards,   
  
Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [May 27, 2008, 1:23am UTC](https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307/3 "2008-05-27T01:23:23Z")

</div>

Hi Angus, thanks a lot for the quick response. I dont know the default varialbes but will try what you have suggested.&nbsp; regards, Richard

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [May 27, 2008, 1:29am UTC](https://www.finalbuilder.com/forums/t/variables-dont-produce-the-expected-result/4307/4 "2008-05-27T01:29:23Z")

</div>

Hi Richard,   
  
 Great, please let us know how you go.   
  
 It looked like the Define Variable actions were configured to set default values on many of the variables, so you may want to reproduce those in the Edit dialog.   
  
 - Angus
