Hi!
How can I fill automatically fill a field?
E.g.
I have a subform with fields Number and Description that refers to a table.
When I insert a number in the field Number and press "Enter" Button, in the field "Description" I would have the text associated with that number.
I tried to look at the cronus tables and forms but I haven't understood how that works.
Thank you.
Luciana
0
Comments
for this code is written in onvalidate trigger of "No." field
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
I take code similar to table 39 (Purchase Line).
I my table I wrote on OnValidate Trigger in Nro field:
where tArticoli is the table in which I have Nro and Descrizione.
Nro Articolo is the field in form that I insert manually, Descrizione2 is the field in forul that have to be populated automatically.
But nothing happens.
Where am I wrong?
1. a lot of study :whistle:
2. the programming language is english, not italian...please use english names for your variables and fields (if possible)
3. you're setting field descrizione in descrizione2. why?is it correct?is descrizione2 a field or a variable?
4. Did i mention "a lot of study"?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
1. I do what I can I'm studying, so I ask in this forum
2. Pardon, I'm doing an exercise in italian so I hae used italian... but I can translate.
3 Descrizione2 is a text variable, Descrizione is a field in a table
translated is:
In practice I have to do an exercise emulating the purchase oder form.
So i have an Item table (that's not the Item table standard) with an Item Number and a Description.
The Purchase form that I've done, has a subform , containing an Order Nr, an Item Nr, a Description and a quantity field.
When in the subform I select the Item Nr from Item table, in Description field of the subform, I should have the value of Description field of Item Table.
I tried, as mohana suggested, to do the same thing that is contained in code of tab 39, but I don't retrieve anything automatically.
I also tried to set a table relation, but nothing.
I don't understand.
thanks
Luciana
You have to evaluate
description := item.description;
not
description2 := item.description;
moreover, if you are still studying the base, you shouldn't work for an actual production process, you can cause a lot of damages to the customer data! ask your boss/senior developer if they can give you a hand.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
My boss is giving to me exercises to do to understand how C/AL works. I have only a book about C/AL and there's nothing more of what I know, so I have to ask here questions that make me doubtful.
Thank you, now I'm gonna try your solution.
Luciana
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
so, your solution doesn't work for me. uhmmm ...
Do you know what is Onvalidate trigger? it is when you write something in a field and then hit TAB, or Enter, Or Up or dwn arrows....
You're inserting the new value of the field in Nro Articolo, but you've coded the onvalidate trigger of item.Nro: obviously that code is not fired because you've to put it in the onvalidate trigger of Nro Articolo, instead.
But i'm wondering how did you compile the code O.o ...i think there's something messed up with the data structure, too...sorry but if this doesn't work either, i can't help you more, there are too much possible errors :roll:
Good luck!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Now I can see the correct value associated to the Item Nr selected.
It's not automatic, I have to put it in manually (but if I insert the first letter and then I press TAB , it is filled auto).
Better than nothing.
Now I can see the correct value associated to the Item Nr selected.
It's not automatic, I have to put it in manually (but if I insert the first letter and then I press TAB , it is filled auto).
Better than nothing.
Do you have table relation for that field with appropriate table?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
E.g.
I have a subform with fields Number and Description that refers to a table.
When I insert a number in the field Number and press "Enter" Button, in the field "Description" I would have the text associated with that number.
I tried to look at the cronus tables and forms but I haven't understood how that works.
Thank you.
Luciana
your record: item no. and description (and some more fields offcourse)
your subform: a form based on "your record" records which just shows one (card) or more (list) records.
if you want to fill in the item no. and have in description the description of the item:
design table "your record": tablerelation for "item no." is item."no.";
in the onvalidate trigger in your table for "item no." enter the code mentioned in previous posts.
Save and compile your table.
In your form: remove any code in any onvalidate trigger.
That should do it.
The problem here is that you're not thinking in NAV right now.
When you start writing code the first step should always be: where to put my code? aka Define your scope where your code could be handy.
In this scenario the code should be put in table, because you'll always want that whenever you insert/modify a "your record" record, the description will always initially be the description of the item. If the code is put there, then no matter where in the system you add a record of this type, the description will always initially be the description of the item.
If you write the code on the form, then only in that form will the description be placed on your record.
Ask your boss for the C/Side introduction manual. It will help you alot.
(And welcome to the world of NAV, the longer you stay, the more your feelings will be mixed about this program )
|To-Increase|
No, I want thaht the field Description is filled automatically when I press TAB on Item Nr.
Yes I have a table relation for that field.
You should have used
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
YEaahhhh it works!
Thank you.
BTW, move this code to Table OnValidate of Item Nr from form
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Thank you very much for explanations and advices, I'll keep in my mind for next time, they are very very useful [/quote]
A lot of feelings: hate, hate and , I've yet said "hate" ? :P
Seriousely, thank you. I know that these questions are "stupid" but I don't have any guide and no tutor about these things.
I try to do my best.
Luciana
Done.
Thanks.
To everyone.
And I apologize for my very bad english. Some times I don't know how translate some sentences and I do this literally, so some word, some expression, could be strange or imcomprehensible. Thanks also for understandig