Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

How-to

Using AI to write button scripts and test records in Base

In Base by Zaweba your own AI account can write a button script to save, or make ten sample records for a table that are previewed and added in one go.

Using AI to write button scripts and test records in Base

Two jobs slow down almost every new database. One is the small script behind a button, which you know you want but would rather not write from scratch. The other is test data: you can't see whether a form, a query or a report works until there are records in the table, and typing them in by hand is tedious. Base by Zaweba has an AI helper for each, using your own AI account.

Write a script produces a button script. Make sample data fills a table with made-up records to try things out.

Write a script

Describe what the button should do. "Mark the open order as dispatched, set today's date in the dispatched field, and show a message saying so." The AI writes a script that follows Base's scripting guide, the same guide you'll find in the Help menu, so it uses the functions and patterns Base's scripts are meant to use.

Read it before you keep it. Check that it uses the right field names and does what you described, no more and no less. When you're happy, Save as script keeps it as a new script in the database, ready to attach to a button.

Scripts in Base run in a sandbox. They can read and change records in your own tables, but they have no access to files, the network or other programs, and they have a time limit. That holds for AI-written scripts just as for ones you write yourself.

Make sample data

Open a table and choose Make sample data. The AI creates ten made-up records that fit the table's fields. Add records shows them first as a preview, so you can see what is about to go in.

When you add them, all ten go in together in one transaction. If one record breaks a rule, such as a validation rule or a required field, none of them is added. That keeps the table clean: you never end up with seven test records and three missing, and your rules are respected even by test data.

Ten records is enough to check a form's layout, see a report with a few groups in it, and try out a query's conditions. Run it again for more.

Using test data wisely

Make it obvious which records are made up. Sample data is useful while designing, but it shouldn't end up in a real customer list or a real set of accounts. A simple habit is to try things out in a copy of the database, or to delete the sample records before real data goes in.

Sample data is also a good test of your rules. If the AI's made-up records keep failing a rule, either the AI misunderstood the field or the rule is stricter than real life. Both are worth knowing early.

What leaves your PC

For both helpers, what goes to the AI provider is the database's design (tables, fields, types, rules, relationships and the names of queries, forms and scripts) plus the open table or script. Records aren't sent unless you tick Include sample rows, which sends the first three of each table and starts off every time.

Changes are previewed before they happen, and AI > Undo reverses AI changes for the session, so trying either helper is low risk.

Where they fit

These helpers take the slow first steps off your hands. You still decide what the database does and check every result, but you start from a draft script and a table with a few records in it, which is a far easier place to begin than an empty editor and an empty datasheet.