Dear all experts, I would like to ask you how to create a field and its type and also coding that contains the calculation of 3 fields in a new tab of a certain card. For example : field a , type : text field b , type : text field c, type : decimal but will take the contents of other field but different tab, the field c locates in tab x, field e locates in tab y. field e data = field c field d will contain = a x b x c what field type of d and its code or properties set up so that I can get the result according to the formula ? all the fields only use as informative data of an certain item/machine/work center. I beg you please to let me know…thanks in advance rgds, Mark
In general it does not make a difference for Navision WHERE a field is being shown in a form, as all tabs are based on the same record. On the other hand, how do you want to “CALCULATE” based on a text field. Does it contain a decimal value in text interpretation ?
Dear Thomas, Tks a lot for your prompt answer, fortunately you are now online and I am using navision. basically I create 3 fields in a certain card. in the table I add the new fields. Do I have to make a new table ? For example, in the machine card, there is a capacity field and efficiency field. If I make new field in the different and new tab but using the information in the 2 fields I mentioned, how to do that ? What will be the field type of the new one ? Is there another setting or coding for that and where ? in the c/al editor or just in the properties of the new type ? new field will be a result of efficiency x capacity. for example : efficiency = 0.8 capacity = 2 then new field will contain 1.6 rgds, Mark
Do you need to “store” that new “field” in the database or do you just want to display the value at a form ? This makes a huge difference. Please do always refer to a dedicated field number in a dedicated table when you are asking such questions. This makes it easier for other understanding what you are trying to achieve.
Dear Thomas, thanks a lot for your reply. I just want the new fields only store in the card not in a table and it’s only informative data not using in posting to G/L or whatever, because it is just use to rate the certain card and need the data in the field to fill but the data resulted after operation finished. pls let me know how to do that. I don’t know the type of the fields, it properties or coding to do that. pls reply asap. many tks, rgds, Mark
Mark,
quote:
I just want the new fields only store in the card
in fact the card does not “store” any value, it justs shows table data or field that you put on the form. In your case, add a new textbox and add the following expression to the SourceExpr efficiency x capacity and set the textbox editable No - in that example you mention, there isn’t any need to define the datatype of the field, Navision will associate it on its own. By the way, and please take the comment from a constructive side… have a good look through the funcional manuals and then through the applications designer’s guide… also this topic will help you a lot on how to learn Navision…http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=16258 …Deducting from your questions your don’t seem to have a person that is supporting you in learning Navision, and that makes it a tough challenge… nevertheless, go for it [;)] Saludos Nils
Hi Nilsm, thanks for your reply. I know that the card would not store but just showing data and I have set the field type to be text for three new fields. But the fourth field will be the result of field 1 times field 2 times field 3. I have set the source expression and did trial and error but untill now not work. rgds, Mark
You can only multiply numeric values. So if you store numeric values in a text field, you need to convert the content to a decimal value first. the command you need is EVALUATE. Basically you need to define a global decimal variable for each text field you want to use to multiply. Then you apply the following code to the OnAfterGetRecord trigger: IF NOT EVALUATE(v1,Text1) THEN v1 := 0; IF NOT EVALUATE(v2,Text2) THEN v2 := 0;
next step would be to create a new text field in the card and write the following text to the SourceExpression property of this field: v1 * v2 * v3 That’s it.
Dear Thomas, thanks for your answer but I can’t find onaftergetrecord in the C/AL editor of a table. I have explained that I want to put a field in a card not in a report. You give me the unnecessary answer. I will make an example : 1. field x type : ?? 2. field y type : ?? 3. field z type : ?? 4. field a type : ?? field a = x * y * z how to set the field a in the card so that every time I fill field x, y, z, the result exists in field a. tks a lot for your answer. rgds, Mark
Hello, To keep things simple. If the fields already exist on the table and you simple need to do mathimatical calculations. Just do it. Ex: Item Card go to designer. Add new field (Don’t give it a variable or sourceExp yet.) Next write down the field names Ex: “Standard Cost” “Unit Cost” AverageCostLCY Next go to the property on the new field sourceExp and type the formula directly into it ex: “Standard Cost” * “Unit Cost” * AverageCostLCY. Nothing else. Just run it from the FILE → RUN and see the calculations in action. Its called calculation on the fly, not stored anywhere just for display. By the way, you can use the same trick on reports. Note: Just remember what the other topics stated as well. TEXT * TEXT will not work. Use the EVALUATE feature is needed to convert TEXT to DECIMAL OR INTEGER prior to calculations.
quote:
but I can’t find onaftergetrecord in the C/AL editor of a table.
that trigger is available in “Forms” - as you mention you want to add the field on forms… and that’s exactly what Thomas is explaining!
quote:
You give me the unnecessary answer
Please try to be a bit more polite, all these people here are giving their advice on a voluntary basis, and investing their spare time to post all those answers, and it’s not always easy to understand and explain to a person who is just getting started in Navision! And why do you have problems with the field types??? If you want to do mathematical calculations either use integer type fields (without decimals) or decimal type fields… If you can be more precise about what you are trying to achieve, than it would be much easier to give you precise indications, like do these fields already exist in the table, what possible field types do you want to multiply… Saludos Nils
[:(] I am very sorry for my reply. Basically my question is that I have create 4 fields in the machine card table. Of course, I will go to its form and insert the fields into it. I just want to make the fourth field is a result of field 1 x field 2 x field 3. When I filled the 3 fields with number for example 20, then the fourth field will be filled with value 800. the fourth field is uneditable and the other is yes. what is the field type and how to do that ? rgds, Mark
Mark, start with defining the 3 new fields in the table as type decimal, put them into the form, add a new textbox to your form and edit the sourceexpr property (there is no need to define the data type, text fields will display anything form text to numerical values, etc.) with Field1 * Field2 * Field3 and that’s all… Where do you get stuck, which part doesn’t work out for you? Saludos Nils
Dear All experts, Ithank you for your answers to me, it’s very nice to have them but I will close this topic because I have found out what I want including your help also give a contribution, do I need to put them here which purposed to compare ? rgds, mark
Well, you don’t have to at all, sometimes it’s interesting to know how the other person resolved the issue for further support or reference, in other cases it’s sufficient to know that you were able to resolve it - which is in the end the most important point… and therefore thanks for your comment that you were able to figure it out, this also give the other participants an idea that the effort was worth it [;)] Saludos Nils