Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi.

My script evaluates a large global text field for certain criteria. When the criteria are found, a new record is created using a value from the global text field related to those criteria.

I only want one record for each value to be created even if the value repeats in the global text field. Furthermore, a record with that value may already exist from previous data used in the global text field and if found again in new data, a new record should not be created. i.e. if the value in the global text field has been encountered before (either in the current global text field or those that have been evaluated previously) then a new record should not be created.

The problem is that the script has to be a be able to run unattended, so answering dialog boxes regarding "unique values" or "no matching finds" will not be possible.

Any help would be appreciated.

Thanks

Posted

I'm not sure I follow this fully, so this is more or less a guess:

Place the currently considered value in another global field. Define a relationship matching this global field to the value field in existing records. If there are no related records, create one.

Or just enable the relationship to create new records and create records that way (if a related records exists, it's value will be overwritten by same).

Posted

Without having a complete understanding of what you are doing and why makes it difficult to give you a definitive answer. How large a global text field, how many records must be checked, does the text continually change or is it constant?

This is just a thought.

Set a global flag when the first (new)record is created. In your script check first to see if created exists, if so, end script.

But, as I said, without more detail I can't be sure this would accomplish your goal.

Posted

Sorry, I tried to simplify it and made it more confusing.

OK. My script loads a webviewer page from a medical lab database with an html interface. The script then loads the webviewer source into a global field (scrapes). This source data contains medical record numbers of many patients. When the script encounters the criteria that indicates a medical record number, a new record is created with that medical record number. The medical record number may occur more than once in the source data, but I only want it to create a new record once. Furthermore this script is run daily, so the medical record number may already have an entry from a previous day or even months prior, however I still only want that medical record number to have one record in the database.

If this helps, there is another related table in the database where the script creates a new record each time a medical record number is encountered. So this table has many duplicate entries. The purpose of what I describe above, is to have another table acting as an index where each medical record number occurs once, but will but have a one to many relationship to the table where there are many occurences of the same medical record number.

I'm not sure if this clarifies it, but thanks for your help anyway.

Posted

As Michael has already stated, if you place the value of the medical record number into another global field and have a relationship from this new global field to the medical record number field from your other table, you can do this rather easily.

You would loop throught your original global field and set the new global field with the value. Then if you have allow creation of record on, if it encounters a new medical record number that does not exist, it will create a new record, otherwise it would set the same value.

Posted

Since you have the two tables and a relationship between them, it can be even simpler. Let's call your tables Log (duplicate entries) and Index (unique entries). Enable the relationship between Log and Index to create new records in Index. In your script, right after creating a new record in Log, add:

Set Field [ Index::ID ; Log::ID ]

Posted

No, because a duplicate will never be created. If the entry already exists, then Set Field[] will act upon it, and replace the value in Index::ID with the same value.

This topic is 5899 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.