Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating Dummy Records Script

Featured Replies

quote:

Originally posted by BikeBoy:

Hi everyone,

I wrote a script, that is supposed to loop through the records, and insert dummy line items where needed. My logic is to first loop through the employees only within certain company, and then loop through all records. The problem is that this script sometimes works and sometimes doesn’t, and behaves very naughty.

Lets say I have following fields:

Company# (Text)

Employee# (Number)

Company Count (Global, Text)

Created? (Number)

Here’s the script:

Sort[] # sort on Company# and Employee#

Go to record[first]

Loop

Set field[“company count”, “Company#”]

Loop

Go to record[exit after last, next]

Exit loop if [“Company# <> company count”]

Hi everyone,

I wrote a script, that is supposed to loop through the records, and insert dummy line items where needed. My logic is to first loop through the employees only within certain company, and then loop through all records. The problem is that this script sometimes works and sometimes doesn’t, and behaves very naughty.

Lets say I have following fields:

Company# (Text)

Employee# (Number)

Company Count (Global, Text)

Created? (Number)

Here’s the script:

Sort[] # sort on Company# and Employee#

Go to record[first]

Loop

Set field[“company count”, “Company#”]

Loop

Go to record[exit after last, next]

Exit loop if [“Company# <> company count”]

Sure JP. I need to insert dummy employees 21 (VP) and 22(President) in every company, if they don't already exist. They're always last employees in the company (companies are small).

here's the full script:

Sort[] --sort on Company# and Employee#

Go to record[first]

Loop

Set field[“company count”, “Company#”]

Loop

Go to record[exit after last, next]

Exit loop if [“Company# <> company count”] --if last employee in that

End loop --company

If status(currentRecordNumber)<>status(CurrentFoundCount)

Go to record(next)

End if

if (Employee# =22)

go to record(previous)

if (Employee#<21)

New record

set field (Employee#, 21)

set field(created?, 1)

got to record(next)

end if

end if

if (Employee# =21)

new record

set field (Employee#, 22)

set field(created?, 1)

end if

if (Employee# <21)

new record

set field (Employee#, 21)

set field(created?, 1)

new record

set field (Employee#, 22)

set field(created?, 1)

end if

go to record(exit after last, next)

exit loop if status(currentRecordNumber)=status(CurrentFoundCount)

end loop

refresh window

  • Author

Hello BikeBoy,

it seems to me you are doing an enormous effort to accomplish a not well crafted job.

Pardon me but, following my logic, in similar circumstances i use two separate files (with relation on COMPANY_NAME):

- Company db

- Employees db

in the first db i use a portal to enter employees records in the second db: this technique easily allows the search of recs. 21 and 22 in the related db (employees) and, evenctually, the adding of them.

An alternate solution, working on a single file, is to earn a relation one-to-many, based on COMPANY field and a global field.

Tell me your opinion about and i will help asap to build your solution.

Take note that to split your db in two dbs is a very easy operation.

Best regards.

JP,

What I need is not to "enter records" as I go along, but to insert records into the existing database. Lets say I have two thousand companies, each has employees. Some companies have 21 and 22 employees, some don't. Those that don't must be inserted. If this is doable with your method, I'm all ears.

PS How to split a DB in two?

Thganks again

  • Author

Hi,

take a look to your mailbox .... laugh.gif" border="0

Greetings

Thanks a bunch, JPaul!!

I apreciate your help. I looked at the files, and learned a lot from them. This is good for automatically inserting dummy employees while the user is keying in the data. This is a different aproach from what I was thinking, but very nice.

Thanks again.

  • Author

Hello BikeBoy,

very happy to be, in some way, helpful.

Just a little thing: don't approach & learn my technique files just as they appear; as i've said INVESTIGATE !!

You can easily earn a self-join on the same file and use GOTO RELATED (and the rest of the script) to build your own loop; obviously this is to check the presence of th 21 & 22 in the just inserted records' lot.

Magnifying the ranges of the loop you can also fill an entire empty file !

Best regards & have nice jobs. shocked.gif" border="0

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.