Re: Split to Array on Repeat Skips Every Other Line??

2005-05-16 Thread Sivakatirswami
Yes! Brian, that works... and yes, Alex, you are also right, splitting 
x is indeed breaking the guideline described in the docs.

thanks
skts
On May 15, 2005, at 8:36 PM, Brian Yennie wrote:
Just out of curiosity, what happens with the following:
global gSomeData # which has six lines  of data
repeat for each line x in gSomeData
   put x into y
   split y with "|" and tab
   put y["Project"] & tab &  (y["hours"] +round(y["hour-fraction"],2)) 
& tab & y["Fund_Category"] & cr after tLog
end repeat

Wondering if Rev was having some trouble with the "repeat for each" 
variable being used as an array...

- Brian
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Split to Array on Repeat Skips Every Other Line??

2005-05-16 Thread Phil Jimmieson
Alex Tweedly wrote:
Sivakatirswami wrote:
OK, well I solved the problem by taking the split out of the loop 
to a function, now it works. But I still think this is a bug.

No, I don't agree. The docs say very clearly
Important!  You cannot change the labelVariable in a statement 
inside the loop. Doing so will cause a script error. You can change 
the content of the container, but doing so will probably produce 
unexpected results.
since "split" does change x (into an array, and to a different 
value), you're breaking the rule, and can't expect this to work.
Hi Alex,
thing is that this *used* to work in an earlier version of Rev. I 
can't remember which version broke it, but one day my scripts were 
working, and the next (after an update) they didn't... Took me a 
while to figure out what was going wrong (and I bugzilla'd it).

It would be really helpful if the documentation explicitly mentioned 
that split on a foreach variable will have this effect.

--
Phil Jimmieson  [EMAIL PROTECTED]  (UK) 0151 794 3689  (Mobile) 07976 983164
Computer Science Dept., Liverpool University, Chadwick Building, Peach Street
Liverpool L69 7ZF  http://www.csc.liv.ac.uk/~phil/
  I used to sit on a special medical board... ...but now I use this ointment.
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Split to Array on Repeat Skips Every Other Line??

2005-05-16 Thread Alex Tweedly
Sivakatirswami wrote:
OK, well I solved the problem by taking the split out of the loop to a 
function, now it works. But I still think this is a bug.

No, I don't agree. The docs say very clearly
Important!  You cannot change the labelVariable in a statement inside 
the loop. Doing so will cause a script error. You can change the 
content of the container, but doing so will probably produce 
unexpected results.
since "split" does change x (into an array, and to a different value), 
you're breaking the rule, and can't expect this to work.

Passing x as a parameter to the function passes a *copy* of the data, 
and hence avoids breaking the rule.

I'm not sure what Rev intended by the phrase "cause a script error" - it 
certainly doesn't cause the script to stop with the error box, in any 
example I could think of - but it does produce "unexpected" results in 
some cases.

on mouseUp
   repeat for each line x in gLogData
  put returnLogEntry(x) & cr after tLog
   end repeat
  put tLog into fld "logViewer"
end mouseup
function returnLogEntry x
  split x with "|" and tab
  return (x["Project"] & tab &  (x["hours"] 
+round(x["hour-fraction"],2)) & tab & x["Fund_Category"])
end returnLogEntry

Now I get all six lines as expected:
Online-Donations5.41Public Services
Publishers-Desk-Interface1.25Public Services
Digital-Dharma-List6.5Public Services
Web-Editor-Upgrade2.17Public Services
Publishers-Desk-Interface6.75Funded Projects
Online-Donations1.08Public Services
skts
--
Alex Tweedly   http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 12/05/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Split to Array on Repeat Skips Every Other Line??

2005-05-15 Thread Brian Yennie
Just out of curiosity, what happens with the following:
global gSomeData # which has six lines  of data
repeat for each line x in gSomeData
   put x into y
   split y with "|" and tab
   put y["Project"] & tab &  (y["hours"] +round(y["hour-fraction"],2)) 
& tab & y["Fund_Category"] & cr after tLog
end repeat

Wondering if Rev was having some trouble with the "repeat for each" 
variable being used as an array...

- Brian
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Split to Array on Repeat Skips Every Other Line??

2005-05-15 Thread Sivakatirswami
OK, well I solved the problem by taking the split out of the loop to a 
function, now it works. But I still think this is a bug.

on mouseUp
   repeat for each line x in gLogData
  put returnLogEntry(x) & cr after tLog
   end repeat
  put tLog into fld "logViewer"
end mouseup
function returnLogEntry x
  split x with "|" and tab
  return (x["Project"] & tab &  (x["hours"] 
+round(x["hour-fraction"],2)) & tab & x["Fund_Category"])
end returnLogEntry

Now I get all six lines as expected:
Online-Donations5.41Public Services
Publishers-Desk-Interface   1.25Public Services
Digital-Dharma-List 6.5 Public Services
Web-Editor-Upgrade  2.17Public Services
Publishers-Desk-Interface   6.75Funded Projects
Online-Donations1.08Public Services
skts
On May 15, 2005, at 8:00 PM, Sivakatirswami wrote:
Incoming data stored in a global and then try to split this on a 
loop...
every other line on output is empty.

global gSomeData # which has six lines  of data
repeat for each line x in gSomeData
   split x with "|" and tab
   put x["Project"] & tab &  (x["hours"] +round(x["hour-fraction"],2)) 
& tab & x["Fund_Category"] & cr after tLog
end repeat

put tLog
returns:
Online-Donations5.41Public Services
0   
Digital-Dharma-List 6.5 Public Services
0   
Publishers-Desk-Interface   6.75Funded Projects
0   
Every other line is skipped!
???
 I *can* re-do this using an itemdel algorithm and skip the split to 
array,
but using these little arrays is so much more efficient (if it worked 
of course)

Sivakatirswami

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Split to Array on Repeat Skips Every Other Line??

2005-05-15 Thread Sivakatirswami
Incoming data stored in a global and then try to split this on a loop...
every other line on output is empty.
global gSomeData # which has six lines  of data
repeat for each line x in gSomeData
   split x with "|" and tab
   put x["Project"] & tab &  (x["hours"] +round(x["hour-fraction"],2)) 
& tab & x["Fund_Category"] & cr after tLog
end repeat

put tLog
returns:
Online-Donations5.41Public Services
0   
Digital-Dharma-List 6.5 Public Services
0   
Publishers-Desk-Interface   6.75Funded Projects
0   
Every other line is skipped!
???
 I *can* re-do this using an itemdel algorithm and skip the split to 
array,
but using these little arrays is so much more efficient (if it worked 
of course)

Sivakatirswami

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution