new records with fields filled based on default var

Hi there,

I’m a bit stuck.

I have a form where users can insert records.

i would like the user to choose some values and then insert that values in the new records so the user don’t have to type all the data again.

so a user would give up a value, press new record and then 10 records appear with that value already inserted

i have a form with the field appointment that has a defined value [type_appointment] as standard var

works when i test it.

now i thought i make a control form and let the users type in the value and parse that to the form.

i can’t figure out how to do that. any suggestions?

i use this code in the control form in

onvalidate
sc_commit_trans();
sc_redir(W_gesprekken_aanmaken, wk_id= -1, appointment = [type_appointment]);

/*

  • the -1 in the id starts the form in insert mode (new)!
    */

So for example if the user wants 6 new appointments he types a 6 in a field on the control. When pressing a button (ok) you run the sql to add 6 records (with loop or multiple values). The you redirect to the form also passing the ‘6’ values and LIMIT the sql by value 6 and ordering the sql result DESC. So you will have the 6 latest records in the form.

I haven’t tried it, but maybe it can help a bit :slight_smile:

redir should look something like this:
sc_redir(W_gesprekken_aanmaken, wk_id= -1, appointment = [type_appointment], aantal = {field_aantal});

adding multiple values mysql:

INSERT INTO tasks(title, priority)
VALUES
    ('My first task', 1),
    ('It is the second task',2),
    ('This is the third task of the week',3);

Thuis could do the truck, but sonehow the control form don’t pass the vars

store the vars in a global so it is available in all apps. No need to pass in de sc_redir macro.

@nonkelmike Hero! I will try this out. but reading this code is a much better solution then the one i’ve got…

ftr. when you store vars in the control fields option doesn’t do a thing.