Skip to main content

Counting while..

hi all,
new to idea scripting..
how can i create field that counts while somthing happans in other field?
foe example:
in every row, as long as Employee Number is the same, keep counting 1...2...3...4...
and when the number changes to another Employee, start all over again 1..2..3...

noamh Wed, 06/28/2017 - 03:14

Tnank You Brain!
when i try the script, i does not quiet work.. as you see the image, the "counting" doesn'nt count and i would like it to start counting every time there is a change in the field (even if the data repeat itself every couple of rows. for the first "1-1" it suppose to be 1,2,3 and for second "1-1" starts again 1,2 .
in the middle, the "1-0" would just give me a solid 1 counting..
 

Brian Element Wed, 06/28/2017 - 07:14

Hi noamh,

That is interesting.  I created a test file that was similar to yours:

I ran the script.

Thisis what I got.

Now one thing I forgot to add to the script is you need to close the file and reopen it to view the count field properly.

I just noticed something, are you running this on a virtual field?  If so can you recreate the field as an IDEA field, so when creating the field select Character instead of virtual Character.  The problem is virtual character fields stores the formula and not the results but we want to do this on the results.  I will update the script to add a warning about that or maybe to filter out virtual fields.

Thanks

Brian

Brian Element Wed, 06/28/2017 - 10:13

Hi Noamh,

First you create the IDEA Character Field using the Field Manipulation.  The field length should be the same as the virtual file.

Then click on parameter and just enter in the field you want to copy, in my case the virtual field.

click on validate and exit and then exit and you should have your new field.

Let me know how this goes.

Brian

 

noamh Thu, 06/29/2017 - 01:12

still not working..
did exactly as shown and got the same error.
attached the picture (don't mind the hebrew fonts, tried to change them to english and didn't work neither)

Brian Element Thu, 06/29/2017 - 05:11

Hi noamh,

This is strange.  Any chance you can share with me the parts of the file, such as the two fields that create your virtual field so I can try and understand what is going on.  I am wondering if it is a problem between my ASCII version and your Unicode version.  The problem is the script seems to work fine for me. 

If you want to share it you can email me at brian.element@ideascripting.com.

Thanks

Brian