Wierd Little Lookups

I’ve already worked around this, I’m mostly asking for understanding in future cases. I have a source table with a Code(code:10) and Description(text:30). I have the LookupFormID setup. From most tables/forms, as long as the validation is setup, the form does proper lookup. However, on one field on another table which (I think) may have had OnLookup code before this update (now deleted), the lookup does not work. I setup a field the exact same way and the lookup works perfectly fine. Here’s where it gets really fun. I put a line of code on the field’s OnLookup, just MESSAGE(‘Test’). The lookup no longer happens, just the message box - as it should. I deleted the code, and the lookup returned perfectly fine. Now, given all that, WHY does the first field’s lookup not work?! It’s setup the same, code’s existed and all was deleted, etc. As I said, not urgent, just trying to prevent any future issues and understand what the heck it’s doing. Jeremy

If there is something written in OnLookup trigger, then Lookup doesn’t work, because Navision “thinks” that you programmed it. It could be even comment. (// or {})

Ha! a good paint that made me think of one more thing. I dug down, and yup… even Local Variables will through it off. The code was completely clear but one Local remained. Very strange that Locals would make a difference. Ah well. The mystery ends.

quote:


Originally posted by JDVyska
Very strange that Locals would make a difference. Ah well. The mystery ends.


Well, empty trigger functions are “not really there”, even though you can see them in the C/AL editor (otherwise you could not create them [;)]). Try exporting an object as text and examine the file. There are no empty trigger stubs in the file. Only when there is something in the function will the function “come to life”. A local variable is an integral part of the function and will cause it to be exported etc.