youkn0wwho Posted May 17, 2003 Posted May 17, 2003 I have 45 records, and I have a field name "selected number". How can I make a script that can tell me which one got selected first? Let say my first record came up randomly is 'C', then in the field "selected number" should have number'1' in it. If the second record came up to be 'T', then the field "selected field should have number '2' in it. And so on. Please help me, I appreciated it.
EddyB Posted May 17, 2003 Posted May 17, 2003 Not sure exactly without seeing your random script but couldn't you just add a Set Field script step into your random script? Ed
Ugo DI LUCA Posted May 17, 2003 Posted May 17, 2003 Hi, Re-using Dan's awesome Random script and introducing in it a selected and global field g_selected field : Show All Records Set field (g_selected, 0) Loop SetField(gRandom, "Round(Random* Status(CurrentFoundCount) + .5, 0)") GoToRecord/Request/Pate ("gRandom") Set Field (selected, g_selected+1) Se Field (g_selected, selected) Omit Record Exit Loop If (Status(CurrentRecordCount) - Status(CurrentFoundCount) = 15) End Loop Show Omitted
EddyB Posted May 17, 2003 Posted May 17, 2003 Sorry, I misunderstood, I thought you already had a random script and just wanted to add in the selection number, sorry! Ed
youkn0wwho Posted May 17, 2003 Author Posted May 17, 2003 But the field 'selected number' can't be global, it has to be in other format if I want my records to have different numbers for them.
EddyB Posted May 17, 2003 Posted May 17, 2003 Hi, You need to look at Ugo's post again What is happening is there is 1 global field - g_Selected this gets set to 0 at the start of the script Then in each loop the current record's Selected field is set to g_Selected + 1 The global field is then set to the current record's Selected field ready for the next record... g_Selected = 0 FIRST LOOP Current record Selected field = 1 (g_Selected + 1) g_Selected = 1 (Current records Selected Field) SECOND LOOP Current record Selected field = 2 (g_Selected + 1) g_Selected = 2 (Current records Selected Field) and so on... Ed
Recommended Posts
This topic is 8207 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now