Get the value of property CaptionClass

einsTeIn.NET
Member Posts: 1,050
Hi guys,
I just created another (imho better) form of Zoom. Some more information and FlowFields are calculated even if they are not displayed on the main form. If someone is interested in here's the code:
But now a have two problems:
1. I want to add a functionality like UpdateOnAction, but I believe that's not possible. But that's not the end of the world, the second one is more important.
2. I want to display the Field Caption as it is setup by CaptionClass. So, does anybody has an idea of how to get the value of the CaptionClass of a certain field?
I just created another (imho better) form of Zoom. Some more information and FlowFields are calculated even if they are not displayed on the main form. If someone is interested in here's the code:
OBJECT Form 50500 Zoom { OBJECT-PROPERTIES { Date=23.05.06; Time=21:15:33; Modified=Yes; Version List=ZOOM1.00; } PROPERTIES { Width=11990; Height=14960; Editable=No; InsertAllowed=No; DeleteAllowed=No; ModifyAllowed=No; TableBoxID=1110300000; SourceTable=Table2000000041; OnCloseForm=BEGIN RecRef.CLOSE; END; OnAfterGetRecord=BEGIN FRef := RecRef.FIELD("No."); IF Class = Class::FlowField THEN IF FRef.CALCFIELD THEN; FieldValue := FORMAT(FRef.VALUE); IF Type = Type::Option THEN BEGIN EVALUATE(OptionInt,FieldValue); OptionInt += 1; FieldValue := SELECTSTR(OptionInt,FRef.OPTIONCAPTION); END; IF NOT ObjRec.GET(ObjRec."Object Type"::Table,RelationTableNo) THEN CLEAR(ObjRec); IF NOT FieldRec.GET(RelationTableNo,RelationFieldNo) THEN CLEAR(FieldRec); END; } CONTROLS { { 1110300000;TableBox;220 ;220 ;11550;13750;HorzGlue=Both; VertGlue=Both } { 1119438000;TextBox;344 ;3960 ;1700 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=TableNo } { 1119438001;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438000; InColumnHeading=Yes } { 1119438002;TextBox;2044 ;3960 ;1700 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr="No." } { 1119438003;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438002; InColumnHeading=Yes } { 1119438004;TextBox;3744 ;3960 ;4400 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=TableName } { 1119438005;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438004; InColumnHeading=Yes } { 1110300007;TextBox;0 ;0 ;3410 ;0 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=FieldName } { 1110300008;Label ;0 ;0 ;0 ;0 ;ParentControl=1110300007; InColumnHeading=Yes } { 1110300019;TextBox;3410 ;0 ;3410 ;0 ;ParentControl=1110300000; InColumn=Yes; SourceExpr="Field Caption" } { 1110300020;Label ;0 ;0 ;0 ;0 ;ParentControl=1110300019; InColumnHeading=Yes } { 1110300001;TextBox;6820 ;2530 ;3410 ;440 ;ParentControl=1110300000; InColumn=Yes; CaptionML=ENU=Value; SourceExpr=FieldValue } { 1110300002;Label ;0 ;0 ;0 ;0 ;ParentControl=1110300001; InColumnHeading=Yes } { 1119438018;TextBox;18045;3190 ;550 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=Type } { 1119438019;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438018; InColumnHeading=Yes } { 1119438008;TextBox;17277;2640 ;1700 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=Len } { 1119438009;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438008; InColumnHeading=Yes } { 1119438016;TextBox;17860;2860 ;4400 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr="Type Name" } { 1119438017;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438016; InColumnHeading=Yes } { 1119438006;TextBox;8573 ;1980 ;550 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=Class } { 1119438007;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438006; InColumnHeading=Yes } { 1119438012;TextBox;10054;3740 ;1700 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=RelationTableNo } { 1119438013;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438012; InColumnHeading=Yes } { 1119438020;TextBox;26511;1870 ;4400 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; CaptionML=ENU=RelationTableName; SourceExpr=ObjRec."Object Caption" } { 1119438021;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438020; InColumnHeading=Yes } { 1119438014;TextBox;11754;3740 ;1700 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=RelationFieldNo } { 1119438015;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438014; InColumnHeading=Yes } { 1119438022;TextBox;29051;1540 ;4400 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; CaptionML=ENU=RelationFieldName; SourceExpr=FieldRec."Field Caption" } { 1119438023;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438022; InColumnHeading=Yes } { 1119438010;TextBox;19156;4290 ;550 ;440 ;Visible=No; ParentControl=1110300000; InColumn=Yes; SourceExpr=SQLDataType } { 1119438011;Label ;0 ;0 ;0 ;0 ;ParentControl=1119438010; InColumnHeading=Yes } { 1110300027;CommandButton;4730;14190;2200;550; HorzGlue=Right; VertGlue=Bottom; Default=Yes; PushAction=LookupOK; InvalidActionAppearance=Hide } { 1110300028;CommandButton;7150;14190;2200;550; HorzGlue=Right; VertGlue=Bottom; Cancel=Yes; PushAction=LookupCancel; InvalidActionAppearance=Hide } { 1110300029;CommandButton;9570;14190;2200;550; HorzGlue=Right; VertGlue=Bottom; PushAction=FormHelp } } CODE { VAR RecRef@1110300001 : RecordRef; FRef@1110300004 : FieldRef; ObjRec@1119438000 : Record 2000000058; FieldRec@1119438002 : Record 2000000041; FieldValue@1110300000 : Text[1024]; OptionInt@1119438001 : Integer; PROCEDURE SetRecord@1110300007(RRef@1119438000 : RecordRef); BEGIN RecRef := RRef; IF RecRef.NUMBER <> 0 THEN BEGIN FILTERGROUP(0); SETRANGE(TableNo,RecRef.NUMBER); FILTERGROUP(2); END; END; BEGIN END. } }The only thing you have to do is place a MenuButton on the form you want to zoom. Type in Ctrl+F8 in ShortCutKey and define these two little local variables in OnPush:
And copy these small lines of code to the OnPush-Trigger:Name DataType Subtype Length
RecRef RecordRef
Zoom Form Zoom
RecRef.GETTABLE(Rec); Zoom.SetRecord(RecRef); Zoom.RUN;Additionally you could
- Scale down the MenuButton and hide it behind another control of the form
- Prevent the user from using the real zoom by setting up the user rights
But now a have two problems:
1. I want to add a functionality like UpdateOnAction, but I believe that's not possible. But that's not the end of the world, the second one is more important.
2. I want to display the Field Caption as it is setup by CaptionClass. So, does anybody has an idea of how to get the value of the CaptionClass of a certain field?
"Money is likewise the greatest chance and the greatest scourge of mankind."
0
Comments
-
einsTeIn.NET wrote:2. I want to display the Field Caption as it is setup by CaptionClass. So, does anybody has an idea of how to get the value of the CaptionClass of a certain field?
look at function"CaptionClassTranslate" in codeunit 1 (Appl.managment).
it's really interesting........0 -
Thanks for your answer.
I know about this trigger in CU1. My problem is that the zoom should work for every table. So, if I use FieldRef.FIELDCAPTION I will always get the caption of that field in the current language. But I want to get the runtime caption of that field."Money is likewise the greatest chance and the greatest scourge of mankind."0 -
No idea so far? This would also be helpful for messages, error messages and confirms. Sometimes a user couldn't do anything with Global Dimension 1 Code, but with Department Code. As you can imagine this new zoom is only the beginning. You could create a setup where you can define which user should have access to which field. Thus the user will only see the fields you want him to see.
P.S. The UpdateOnAction issue has the useful side effect that you can compare two records when you place two instances of the new zoom form side by side."Money is likewise the greatest chance and the greatest scourge of mankind."0 -
Hi...
It is a while ago .. but I am facing the same issue.
Did you found a solution to get the caption of a fieldref, which has a captionclass?
thanks!0 -
No, I didn't find a solution by now.
Btw, it's not just helpful for RecordRef / FieldRef. If you want to display a field's name in a message box, error message, confirm dialog, etc. and you use normal record variables then you will also don't get the CaptionClass field name."Money is likewise the greatest chance and the greatest scourge of mankind."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