possible to query another table's field and return boolean?

skycatcher
Member Posts: 5
Hi everyone,
I'm working with NAV 5 right now and I seem to be stuck on something simple.
I have added a new field to the Vehicle table called RDKS. (Boolean/Normal/Checkbox)
This field is also added to the Vehicle List form.
On the Vehicle Card I have a Checkbox that shows Vehicle.RDKS and returns True or False so users can see if the field in the table is checked or not.
I also need this checkbox on the reports, such as Sales Quote, Order, etc...
Right now I'm working with Sales Quote and I cannot edit the Sales Header table due to licensing restrictions.
I've added a global var in Sales Quote:
RDKSvorhanden : Record : Vehicle
Since I can't add the field RDKS to the sales header table, I thought there may be a way to just add it to the source exp of the checkbox since the global var should allow me to use RDKSvorhanden.RDKS to access Vehicle.RDKS but that doesn't seem to work correctly.
I've tried a couple things in the OnAfterGetRecord but nothing seems to work.
All I need is for the checkbox to show true or false on the Sales Quote form, depending on what's in the Vehicle.RDKS field.
Any help would be much appreciated, thanks.
I'm working with NAV 5 right now and I seem to be stuck on something simple.
I have added a new field to the Vehicle table called RDKS. (Boolean/Normal/Checkbox)
This field is also added to the Vehicle List form.
On the Vehicle Card I have a Checkbox that shows Vehicle.RDKS and returns True or False so users can see if the field in the table is checked or not.
I also need this checkbox on the reports, such as Sales Quote, Order, etc...
Right now I'm working with Sales Quote and I cannot edit the Sales Header table due to licensing restrictions.
I've added a global var in Sales Quote:
RDKSvorhanden : Record : Vehicle
Since I can't add the field RDKS to the sales header table, I thought there may be a way to just add it to the source exp of the checkbox since the global var should allow me to use RDKSvorhanden.RDKS to access Vehicle.RDKS but that doesn't seem to work correctly.
I've tried a couple things in the OnAfterGetRecord but nothing seems to work.
All I need is for the checkbox to show true or false on the Sales Quote form, depending on what's in the Vehicle.RDKS field.
Any help would be much appreciated, thanks.
0
Answers
-
Can't you do it first with the cronus license in a demo db. Then export and import in your test db.0
-
I only have a dev and live database to work with. They have a developer license but the sales header table can't be modified :-/0
-
Hi, what code have you written (or tried out) on the Sales Quote form? Also, what is the link between the Sales Quote and the record on the Vehicle table? Please let us know, Thanks0
-
Are you confusing forms & tables?
How can you not modify the sales header but have access to OnAfterGetRecordTrigger?
The sales header table is the basis of Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order forms.
Have you tried using a Flowfield using Method:Lookup to show your boolean value from another table?0 -
Sorry, I will try to be more descriptive. I've only been working with Nav for a few months and I haven't had any training, it's just been learning by doing and I still don't quite understand how everything links together. Normally, I would edit the Sales Header (Table 36) and insert a boolean field, link that to the Vehicle table's boolean field and be set (at least I believe so).
Since I cannot modify table 36, I'm not sure how to get Form 41 (Sales Quote) to show a checkbox that is either true or false, depending on what's in the Vehicle Table . booleanfield(RDKS)
In the vehicle table:Enabled Field No. Field Name Data Type Length Description Yes 1028276 RDKS Boolean
Form 41Checkbox name RDKSverify Checkbox SrcExp RDKSvorhanden.RDKS Globals Name DataType Subtype Length RDKSvorhanden Record Vehicle RDKSverify Boolean OnAfterGetRecord //RDKSvorhanden.TESTFIELD(RDKS, TRUE) //MESSAGE('%1',RDKSvorhanden."Search Name Vehicle"); //IF RDKS = TRUE THEN BEGIN //MESSAGE('%1',RDKSvorhanden.RDKS); // RDKSverify := TRUE; //END //ELSE BEGIN //MESSAGE('%1',RDKSvorhanden.RDKS); // RDKSverify := FALSE; //END;
I've tried a bunch of variations but it seems that RDKSvorhanden.RDKS doesn't have a value. I would have thought that since the defined global RDKSvorhanden = Vehicle, that it should return Vehicle.RDKS...but it doesn't.
I haven't tried the flowfield method just yet as mentioned although I did find a post about it on the forums because the example confused me a little.
The checkbox in the vehicle table and on the vehicle card works fine, I just want another checkbox on the Sales Quote, Order, etc to reflect the value from the vehicle table but I'm not sure how to get the two tables to pass values back and forth. It seems I can't access any values from the Vehicle table through the Sales Header without defining the fields there
Thanks for the replies and appologies for the lack of knowledge so far.0 -
skycatcher wrote:seems that RDKSvorhanden.RDKS doesn't have a value. I would have thought that since the defined global RDKSvorhanden = Vehicle, that it should return Vehicle.RDKS...but it doesn't.
Once you answered those questions you need to use the GET or FIND/FINDFIRST/FINDLAST/FINDSET functions on the RDKSvorhanden record to get the data from the database.
If the link is one to one, from Sales Header to Vehicle, (as I assume from what you did so far), then you would add the code to fetch the record in the OnAfterGetCurrentRecord trigger of the Sales Header Form (ID 41 for Sales Quote, ...) and then use the value in the control just as you did.0 -
Thanks for explaining it to me in such a detailed manner, it helped a lot.
It turns out the two tables were linked by Vehicle No. and all I needed to add to the Form 41 OnAfterGetRecord trigger wasIF RDKSvorhanden.GET("Vehicle No.") THEN BEGIN RDKSverify := RDKSvorhanden.RDKS; END ELSE BEGIN ERROR(''); END;
This seems to work as intended, returning true and false for my checkbox
Thanks so much for your help, now I can finally get some sleep!0
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