Why record level variable is empty?

yukon
Member Posts: 361
Hi Expert,
I declared variable in Sales Line table. But that variable is empty after another form close. How to solve it ? Please let me know.
The variable is empty when "Validate" trigger and when i click new line. Why? How can i get data?
I declared variable in Sales Line table. But that variable is empty after another form close. How to solve it ? Please let me know.
g_fnSetValue(var p_code); // At Item List g_codItemCode := p_code; // Sales Line (Record) l_recItem.RESET; g_frmItemList.SETRECORD(l_recItem); g_frmItemList.LOOKUPMODE(TRUE); IF g_frmItemList.RUNMODAL = ACTION::LookupOK THEN g_frmItemList.GETRECORD(l_recItem); VALIDATE("No.",l_recItem."No."); g_frmItemList.g_fnSetValue(g_ItemCode); MESSAGE('%1',g_ItemCode);
The variable is empty when "Validate" trigger and when i click new line. Why? How can i get data?
Make Simple & Easy
0
Comments
-
1) From where is this code called?
2) Which record is empty?
3) All depends on context. because sometime you need to call modify, sometime it will be saved automatically etc.0 -
g_fnSetValue(var p_code); // At Item List g_codItemCode := p_code; // Sales Line (Record) l_recItem.RESET; g_frmItemList.SETRECORD(l_recItem); g_frmItemList.LOOKUPMODE(TRUE); IF g_frmItemList.RUNMODAL = ACTION::LookupOK THEN g_frmItemList.GETRECORD(l_recItem); VALIDATE("No.",l_recItem."No."); g_frmItemList.g_fnSetValue(g_ItemCode); MESSAGE('%1',g_ItemCode);
1. Is the function g_fnSetValue() a function in form 31 Item List:?:
2. You call this function withg_frmItemList.g_fnSetValue(g_ItemCode); MESSAGE('%1',g_ItemCode);
, but where you set the g_ItemCode :?: So, your message will ever be empty.
3. What is the reason why you do this. What do you want to do ?Do you make it right, it works too!0 -
1. Is the function g_fnSetValue() a function in form 31 Item List:?:
---- Yeah! i used Form 31. And Create New Function.
---- g_fnSetValue(ref: paremeter g_ItemCode);
2. You call this function with ----
, but where you set the g_ItemCode :?: So, your message will ever be empty.
--- g_ItemCode Declare at Sales Line Table.
--- g_frmItemList.g_fnSetValue(g_ItemCode); Write At Sales Line "Item No" Validate
--- MESSAGE('%1',g_ItemCode); will show after validate.
--- When i create new line that variable is empty.
3. What is the reason why you do this. What do you want to do ?
--- I want to save that variable because of Item no is default filter with that value when i select new line (item no).
Sorry for my reply is too late.
Best Regards,
YukonMake Simple & Easy0 -
--- When i create new line that variable is empty.
Yes, it is, because the form is using "new" instance of Rec when creating line, it means all variables on the table are cleared...0 -
Hi kine,
Thx... We don't choice for that ](*,)
Regards,
YukonMake Simple & Easy0 -
If you want to fill the field by the value from filter automatically to have the new line "within" the filters, you can use PopulateAllFields property on the form. This will force NAV to fill the fields by the filter values if the filter is filtering on one exact value (this works automatically for primary key fields, this property extends the functionality to all fields).0
-
Hi Kine,If you want to fill the field by the value from filter automatically to have the new line "within" the filters, you can use PopulateAllFields property on the form. This will force NAV to fill the fields by the filter values if the filter is filtering on one exact value (this works automatically for primary key fields, this property extends the functionality to all fields).
I set "Yes" at PopulateAllFields in item list (Form 31). And I go back to Sales Order.
1st I Filter(F7) By Item Category Code = 'PUMP', selected one item no (1000). And then i go to next line Press Item No button. But item list show all. I want to get/see previous data with Filter Item Category Code = 'PUMP' only.
Is it possible with code?
Regards,
YukonMake Simple & Easy0 -
Ah, you want to filter the selection... sorry, do not take into account my previous post, it is about something different...
There is no standard way how to do that. The Lookup form will not save your filters between two lookups. You will need somehow change the OnLookup trigger to save the value,but you need to save it not only in global variable of the Rec, but e.g. in singleinstance codeunit (or you need to change the OnLookup on the form and save the filters in form global variable, but this will work only for the specified form...).0 -
Hi Kine,
That right ...! I accept your suggestion and i also did it. But we can declare at form level. If i write form level, i need to write onlook trigger of all forms. So but i don't have choice for that .... ](*,)
Regards,
YukonMake Simple & Easy0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions