SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
returned values from script library

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
returned values from script library
Author Message
Joshua Youngblood



Joined: 14 Apr 2006
Posts: 82
Country: United States

Post returned values from script library Reply with quote

This is very similar to "Return values from script libraries" by Jamie.
We are using version 3.4.24.
We have a script library named replaceall that will replace a repeated
character in a string with another character. We have one script that passes
this library values that look like this: "1, 3" or "1, 2, 3" or "1, 3, 5".
When I pass in "1, 3" to this library and tell it to replace all spaces
with nothing,...

-----------------------------------------
Here is a small calling script for an example:

dim temp, string
replaceall("1, 3", " ", "", temp)
messagebox temp

Here is the library's code:
// data, find_str, replace_str are all defined as strings.

Dim find_pos, number
Dim find_len, number
Dim replace_len, number

Length find_str, find_len
Length replace_str, replace_len
Pos data, find_str, 1, find_pos

LoopWhile find_pos, END_LOOP

Replace data, find_pos, find_len, replace_str, data

Add find_pos, replace_len, find_pos

Pos data, find_str, find_pos, find_pos
END_LOOP:

Return data <-- At this point the value changes from "1,3"(which is correct) to "01:03:00"
--------------------------------------

I get back "01:03:00" in temp. I've tried using your String function
before the return, but that caused it to do the same thing even before it got
to the return statement. Do you know why this is happening and do
you have any suggestions for correcting it. (Putting a letter in the string
does correct it, but we would like to avoid that if possible.)

Fri Apr 14, 2006 2:11 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7966

Post Re: returned values from script library Reply with quote

Very strange. I am getting the same in 3.4.26 and don't have an explanation for this, other then this is caused by some automatic data type conversion along the way. I can offer a generic workaround based on prefixing numeric vaues witha non-numeric symbol, for example

Dim temp, string, "1, 3"
Concat("x", temp, temp)
ReplaceAll(temp, " ", "", temp)
Mid(temp, 2, 1000000, temp)
MessageBox(temp)

: This is very similar to "Return values from script libraries" by
: Jamie.
: We are using version 3.4.24.
: We have a script library named replaceall that will replace a repeated
: character in a string with another character. We have one script that passes
: this library values that look like this: "1, 3" or "1, 2,
: 3" or "1, 3, 5".
: When I pass in "1, 3" to this library and tell it to replace all
: spaces
: with nothing,...

: -----------------------------------------
: Here is a small calling script for an example: dim temp, string
: replaceall("1, 3", " ", "", temp)
: messagebox temp

: Here is the library's code: // data, find_str, replace_str are all defined as
: strings.

: Dim find_pos, number
: Dim find_len, number
: Dim replace_len, number

: Length find_str, find_len
: Length replace_str, replace_len
: Pos data, find_str, 1, find_pos

: LoopWhile find_pos, END_LOOP

: Replace data, find_pos, find_len, replace_str, data

: Add find_pos, replace_len, find_pos

: Pos data, find_str, find_pos, find_pos
: END_LOOP: Return data <-- At this point the value changes from
: "1,3"(which is correct) to "01:03:00"
: --------------------------------------

: I get back "01:03:00" in temp. I've tried using your String
: function
: before the return, but that caused it to do the same thing even before it got
: to the return statement. Do you know why this is happening and do
: you have any suggestions for correcting it. (Putting a letter in the string
: does correct it, but we would like to avoid that if possible.)

Fri Apr 14, 2006 2:33 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.