Hi
I would like to make a wizard to create items.
I have a problem when I use Item as SourceTable :
I would like the datasource to be blank so that I can fill the field as if it was done by using Item Card and create new, but I get the first record from the Item table.
Is there a way to make the datasource in create mode or is the solution to create a new table and use that as SourceTable ?
Kind regards
Kenneth Jarlshøi Bolø
Dynateam A/S
0
Comments
other solution is look at the other wizard in the sistem ( form 5077 for iteraction in 3.70)
You do not have to have a sourcetable for a form. The New Form Wizard will let you create one without a table (unless that's changed in newer versions), or you can remove it from the form's properties after creation.
You can then just use variables on the form to create the Item entry.
I would try to avoid using an extra 'buffer' table to create these entries.
I have tried that , but if make the form without a datasource and create a variable for it, I have problems with lookup, because I can't use tableRelation on a variable. Then I have to code the lookup and so on.
Kenneth Jarlshøi Bolø
Dynateam A/S
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
You can then add variables to the form. Drop on some textboxes, set the source of the textboxes to the variables AND you will be able to use table relations on the textboxes.
You can then just have an 'Add' button that uses the values from the variables to create a new Item record and insert it.
Let me know if you need any more help.
I have found a solution :
1) I call a codeunit from form Item Card
2) The codeunit call my wizard
Codeunit :
ItemRec.SETRANGE(ItemRec."No.",'');
CreateItemWizard.SETTABLEVIEW(ItemRec);
CreateItemWizard.SETRECORD(ItemRec);
CreateItemWizard.RUNMODAL;
Then after I have keyed in the Item I insert the record, this works fine.
My wizard have now Item as SourceTable
Thank for all your help \:D/
Kenneth Jarlshøi Bolø
Dynateam A/S
I now call my wizard directly from Item Card.
I have created a global variable for the field No. (ItemNumber)
On the trigger OnOpenForm :
SETRANGE("No.",'');
On the trigger OnValidate :
I create a local variable NewItem as Record Item
NewItem."No." := ItemNumber;
NewItem.INSERT;
SETRANGE("No.",NewItem."No.");
On the trigger OnAfterValidate :
CurrForm.UPDATE(FALSE);
\:D/ \:D/ \:D/ \:D/ \:D/ \:D/ \:D/ \:D/ \:D/ \:D/
Kenneth Jarlshøi Bolø
Dynateam A/S