# Setting a PropertySet variable to a calculated value

**URL:** https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489
**Category:** Discussion
**Created:** [June 13, 2007, 4:27am UTC](https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489 "2007-06-13T04:27:28Z")
**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: [June 13, 2007, 4:27am UTC](https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489/1 "2007-06-13T04:27:28Z")

</div>

Hi:

I am using a PropertySet that uses the '.Net Assembly Info' contents and would like to know how I can set one of the values (BuildVersion) to a specific value, for instance, the number of days since 1-1-2000?

This value would be recalculated on each build.

Thanks,

MartinH.

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [June 14, 2007, 12:54pm UTC](https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489/2 "2007-06-14T12:54:18Z")

</div>

Hi Martin,   
  
You can use the "PropertySet Assign Properties" action to set the value of the 'BuildVersion' property. To set the value to the number of days since 1-1-2000, you will need to define a variable and use javascript to set the variable to the number of days since 1-1-2000. You can then set the 'BuildVersion' property to the value of the variable, using the syntax (%Variable\_Name%).   
  
Here is the javascript to calculate the days since 1-1-2000 saving the value into the variable 'BuildVer':   
  
var currentDate = new Date();   
var comparisonDate = new Date(2000, 0, 1);   
var difference = currentDate - comparisonDate;   
  
BuildVer = Math.floor(difference / 86400000);

---

<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: [June 14, 2007, 7:35am UTC](https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489/3 "2007-06-14T07:35:51Z")

</div>

Paul:

Thanks for the information, it's just what I was looking for.

I do, however, have a problem. I can't see how to implement the javascript or where. I have attached a small trial project so you can see what I have done so far (not very much!)

Thanks for your help,

Martin.

[TestProject.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/f43ffa71c95a1b6137b6eaa330a368ecf31b9e60.zip) (27.901 KB)

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [June 15, 2007, 1:19am UTC](https://www.finalbuilder.com/forums/t/setting-a-propertyset-variable-to-a-calculated-value/489/4 "2007-06-15T01:19:17Z")

</div>

Hi Martin,

&nbsp;

You can use the 'Run Script' action to execute the javascript. For more information see [https://www.finalbuilder.com/finalbuilder/Help/HTML/runscriptaction.htm](https://www.finalbuilder.com/finalbuilder/Help/HTML/runscriptaction.htm)

&nbsp;

Attached is the updated project which contains the javascript.

&nbsp;

Regards,

Paul.

[TestProject-Changed.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/e/e7d67f81dd6bd1f39844603ca27bd44dc4fd2452.zip) (32.937 KB)
