Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Shared Variables - unexpected behavior
Topic Summary:
Created On: 01/11/2013 02:28 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 01/11/2013 02:28 PM
User is offline View Users Profile Print this message

Author Icon
BrianPearson
Expert (100-199)

Posts: 149
Joined: 04/08/2005

I'm trying to use a shared variable: CurrentHour with an initial value of %Hour(Now())% in my workflow ... and when i run a task in the Workflow designer that has that variable, it keeps coming up as: 14% (for 2pm)

Why would it have the % after the hour?

 Category Survey
 01/12/2013 12:33 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Brian,

Expressions are not supported with shared variables at this time and, though it looks to be working despite the addition of an extra percentage symbol, this may not be the consistent behavior for this expression every time it gets evaluated. We are reviewing expression support in shared variables and triggers for a future version of our application.




 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 01/12/2013 10:04 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Leonard,
I tested the very same with BPA 9.0.3.4 and it yields the same result with an extra %
I would rather thing, instead of
Expressions are not supported with shared variables
that they are in fact badly supported, while I thought till Brian's post that they were not at all.
Since the expression %Hour(Now())% is working, but the result is marred by an extra %, which denotes a bug.
The obvious workaround is to strip the % in the tasks.


My observations (in BPA 9.0.3.4) :
%Hour(Now())% results OK with an extra %
%Cstr(Hour(Now()))% results OK but enclosed in "
%Now()% is OK but enclosed in #
%ClipBoard()% results in "" (when the cilpboard contains a text)
%Format(now(),"dddd d")% is OK but with surrounding quotes "sunday 13"
a%space(2)%b results in a" "b with 2 spaces between the "
a%space(hour(now))%b results in a" "b with the expected number of spaces
%1/7% yields 0.142857142857143#
%split("one,two,three",",")(1)% results OK in "two"

In summary, the expressions work OK to some degree , but the result is displayed according to basic script syntax rules :
- strings enclosed in "
- integers followed by %
- reals followed by #
- dates enclosed in #



 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 01/14/2013 08:13 AM
User is offline View Users Profile Print this message

Author Icon
BrianPearson
Expert (100-199)

Posts: 149
Joined: 04/08/2005

Thanks Jean and Leonard,

For now, we're just stripping the extra % out at the task using: %Left(SharedVariable,instr(SharedVariable,"%%")-1)%

It's been running fine over the weekend, and we really need a common time because each of the servers running the task might be up to a full minute in variance from one another.

The other thing we're looking at doing as a fall back (but way more steps) is to have a preliminary task do a SQL query, then update a table ... then have all of the following tasks query that table for a common time ... but I like this a lot less than just stripping out an extra %

 Category Survey
 01/14/2013 10:54 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Brian,
I agree the shared var is much simpler.
A way to anticipate a problem if N/A makes a correction in the future and strips the % would be
%replace(SharedVariable,"%%","")% , better than the Left(....)

and this would be transparent if the format changes in a future release.

Or a small upfront task in the workflow that sets correctly the shared var.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 01/14/2013 12:29 PM
User is offline View Users Profile Print this message

Author Icon
BrianPearson
Expert (100-199)

Posts: 149
Joined: 04/08/2005

good call, thanks Jean!

 Category Survey
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 2120 guests browsing this forum, which makes a total of 2120 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog