Option Dr/Cr in customer card

vyanku
Member Posts: 791
I create field Dr/Cr type option,optionstring DR,CR
and write a code on ON validate DR/CR
What can I do ??
and write a code on ON validate DR/CR
IF "Debit Amount" > "Credit Amount" THEN "Dr./Cr." := "Dr./Cr." ::DR ELSE "Dr./Cr." := "Dr./Cr." ::CR;But I will not updated automatically in the card. If i update it from backend then it will reflect in the card.
What can I do ??
0
Answers
-
"Debit Amount" and "Credit Amount" are calculated fields (FlowFields), you cannot update other fields based on their value, because the value is calculated "On Flight".0
-
Then What should I do to display DR, CR on customer card.(Wether the customer balance is DR or CR) ???0
-
firstly u have to usee the calcfield function bcoz credit amount and debit amount r the flow fieldsVikram Dabas
Navision Technical Consultant0 -
I would not do it the way you want it to do. The two amount fields are flowfields, which means the actual values are in another table. You should write your code OnInsert, OnModify, OnDelete ... may be OnValidate.
... I don't recommend this.
I would just calculate it when you open the card form, in a seperate variable. Even, if possible, put it on a seperate form (that way, it's not always calculated, only when you WANT to see it). A typical Statistic form (F9) are usually also variables which are calculated when opening the form... .0 -
vyanku wrote:I create field Dr/Cr type option,optionstring DR,CR
and write a code on ON validate DR/CRIF "Debit Amount" > "Credit Amount" THEN "Dr./Cr." := "Dr./Cr." ::DR ELSE "Dr./Cr." := "Dr./Cr." ::CR;
But I will not updated automatically in the card. If i update it from backend then it will reflect in the card.
What can I do ??
Hi Vyanku,
In Navision, often when you try to do something, its best to take a step back, and say "what do I want to achieve" NOT "how do I want to do it".
Reading between the lines, it looks as though what you really want is a field on the Customer card that shows if the customer is in Debit or in Credit. Also maybe you are trying to update this into an actual field in the customer Table (assuming "Dr./Cr." is an option field and not a variable.
This can beter be done by just calculating based on "Balance", and compare this to zero. Then display based on "Balance" > 0.
Also it is not wise (if this is what you are doing), to have a field in a table updated from processing on a form. Rather just have the value calculated when you run the form.David Singleton0 -
But I just want to show the Dr or CR .So that client can understand that Customer balance is DR or CR.0
-
hey Eric, sorry forth ecross post, you were fasterDavid Singleton0
-
vyanku wrote:But I just want to show the Dr or CR .So that client can understand that Customer balance is DR or CR.
The solutions that Eric and I have offered, are in principle the same, and give you exactly what you need.David Singleton0 -
David Singleton wrote:hey Eric, sorry forth ecross post, you were faster
You are forgiven, my friend O:)0 -
thanks
But how to update the value of DR/CR.??
Suppose balance is become +ve then Dr should be automatically updated from CR to DR. Is there any function for update option value???0 -
vyanku wrote:thanks
But how to update the value of DR/CR.??
Suppose balance is become +ve then Dr should be automatically updated from CR to DR. Is there any function for update option value???
Its very important if you will start developing in Navision to learn about flowfields and how they work. they are key to the whole application, and you really will not be able to get far unless you first understand how they work.
Once you understand how flow fields work you will understand what we are suggesting.
Flow Fields and Flow Filters are explained clearly in the Navision Manuals. Also once you have read about them, then start playing with a test database and look at fields like Inventory in table 27, and the Balance vs Amount fields in table 15.David Singleton0 -
But here DR/CR is not a flow field it is option field having code on onvalidate trigger. Here I am not using flowfield.0
-
Thanks Waldo. It solves my problem.
Will u please tell me what is the difference between Onaftergetrecord() and onaftergetcurrentrecord()???
If I put code on OnValidate() of balance field of form nothing is happend but if I put it on OnAftergetrecord() it works suscessfully. Why?? Becasue if we change the customer (like next costomer) then also OnValidate trigger of balance field is executed.
Will u please explain me the funda behind this triggers???0 -
f we change the customer (like next costomer) then also OnValidate trigger of balance field is executed.
This is not true. OnValidate trigger is called just when the value in the field is changed. Not when you go to another record. And because this field is calculated and is not editable, there is no event which will fire this trigger.0 -
vyanku wrote:Thanks Waldo. It solves my problem.
Will u please tell me what is the difference between Onaftergetrecord() and onaftergetcurrentrecord()???
If I put code on OnValidate() of balance field of form nothing is happend but if I put it on OnAftergetrecord() it works suscessfully. Why?? Becasue if we change the customer (like next costomer) then also OnValidate trigger of balance field is executed.
Will u please explain me the funda behind this triggers???
Vyanku, what do you mean by this?
If this solves your problem, then you don't need to look at on after.. and other triggers.
So either you don't understand how this solves your problem, OR this is a new topic, in which case you should start a new post.David Singleton0 -
Ok . Actually My problem is solved. I just want another information. For taht I will post new topic.
Thanks for reply0 -
Hi Mr Vyanku,
So did anyone post a reply for the differences between OnAfterGetRecord & OnAfterGetCurrentRecord ?
Regards1 Destination, Multiple Route0 -
vyanku wrote:But I just want to show the Dr or CR .So that client can understand that Customer balance is DR or CR.
here's a simple answer if you just want it to standout on the customer card
OnFormat(VAR Text : Text[1024];)
IF "Balance ($)" < 0
THEN CurrForm."Balance ($)".UPDATEFORECOLOR(255)
ELSE CurrForm."Balance ($)".UPDATEFORECOLOR(0);
EDIT**Didn't realize it was a post from 2007 :oops:0 -
edisonl wrote:Hi Mr Vyanku,
So did anyone post a reply for the differences between OnAfterGetRecord & OnAfterGetCurrentRecord ?
Regards
1.click on help
2.View The C/side Reference guide
3.click on Index tab
4.Scroll to onafter....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