Jump to content

This topic is 8426 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Gentleman,

Small problem inside a larger problem. Large problem first.

I need a script that can take an existing series of random four digit numbers and start at 0001 and pick out and apply to a record only those numbers that arent in use yet. I have a dup-check running and have imported the existing numbers in as a serialized field. Now how do I start at the beginning and fill in the missing numbers starting a 0001?

Smaller problem.

I also need to display the number .ie. "0014" in a calc field that simply combines two fields into one. The numbers represent a unique code for commercials and are also defined by an "R" for radio spots and "" for TV.

...calc field =(field_A & field _:.

Field A is a serialized number field B is either an "R" or it is ""blank depending on the media type.

The result should look like this.."0014R" for radio..or "0014" for TV.

I cant seem to get the calc field to show "0014R". I see "14R". I understand why it doesnt show the zero's I just cant seem to make it do it anyway. Any ideas? crazy.gif" border="0

Posted

An answer to your random problem...

Make a database with one field that contains the values you are using. There should be one record for each value, 0001, 0002, etc. Make another field that is a global number field.

Write a script and call it random or something. It should have the following steps.

1) Insert Calculated Text. The calculation should be: Round( Random* Status( CurrentRecordCount), 0) and the field it gets inserted into is the global number field.

2) Go to Field, option: by field value. Choose the global number field as your field value. This will cause the script to go to a record ID which has been randomly defined by the previous script step.

3) Copy the value from your value field. This number will remain in memory to be pasted somewhere as defined by your calling script in your main database.

4) Delete the record. This way, the value cannot get used again.

--------

From your main database, write a script that calls the external random script and comes back with a step to paste your new random value into the field you choose.

Please let me know if this helps or if I can clarify my instructions better. Thanks!

laugh.gif" border="0

This topic is 8426 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.