How to get a control's value of a Page

Shimone
Member Posts: 25
Hi!
I created a new field in a Page (P95). The source expression is the field Comment of T44.
When I validate that field how can I get its value if it's not referred to a record?
Thanks - Simone
I created a new field in a Page (P95). The source expression is the field Comment of T44.
When I validate that field how can I get its value if it's not referred to a record?
Thanks - Simone
0
Answers
-
-
I created just a textbox on the page.
I want to access to its temporary value. This textbox compares on the page like a field, but if you type a value on it and then you close and open the page the value is erased.
I can't find out how to get this value, and memorize it in a table. I think I can do it in the OnValidate trigger.0 -
You can use textbox to compare and show the value only but if you want to memorize value then you must need to add a field in table.
if you type a value on it and want to save this in table field that you have to add then write code on onvalidate of this textbox.0 -
vijay_g wrote:You can use textbox to compare and show the value only but if you want to memorize value then you must need to add a field in table.
I know that. I need to know how to refer in the code to the text box. If it was a record I would use Rec.NameField.
But it's not a record. I wnat to access it to memorize it on a table.
And if I use CurrPage.NameField it doesn't work, because I need the temporary value, not the control.0 -
I know how to write in table. And I used a variable: I specified it on the SourceExpression property of the textbox.
But this variable doesn't change value when I validate the textbox. This is the real problem, maybe I finally explain it correctly, sorry :-k1 -
A variable can't hold value after you close the object(except only if you have set Savevalues property of page to yes).
if you are calculating value to show in this control for each line then how can it show you the value(after reopen this page) that you type on this.
Hope now it's clear to you.0 -
I don't close the page. I keep it open, and I want that when I type something in the textbox the variable assumes that text. Is there a specific event? It should be OnValidate but it doesn't work0
-
Can you be more clear what exactly you need with example and WHY?0
-
mohana_cse06 wrote:Can you be more clear what exactly you need with example and WHY?
A customer wants an additional field in P95 (Sales Quote Subform). We don't want to add fields in the table, so we thought: "Let's add a field (Date Supporto) only in the page, with SourceExpr property assigned to a variable (DateSupporto). Each time the customer writes something in this field that value is stored in the Sales Comment Line (T44). So we don't create new columns."
Here is the code. The record variable Commenti2 refers to the Sales Comment Line, and this is the code I wrote in the trigger OnValidate of field Date Supporto in Page 95.
IF Commenti2.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN
Commenti2.Comment:= DateSupporto;
Commenti2.MODIFY;
END ELSE BEGIN
Commenti2.INIT;
Commenti2."Document Type":= "Document Type";
Commenti2."No.":= "Document No.";
Commenti2."Document Line No.":= "Line No.";
Commenti2."Line No." := 10000;
Commenti2.Comment:=DateSupporto;
Commenti2.INSERT
END;0 -
OK...now I understood your requirement..
without opening comments page,you want to insert/updated comments...
What problem are you facing in this?
I tried your code on Form and its working fine..please Insert Workdate as Date while inserting ..0 -
mohana_cse06 wrote:OK...now I understood your requirement..
without opening comments page,you want to insert/updated comments...
What problem are you facing in this?
I tried your code on Form and its working fine..please Insert Workdate as Date while inserting ..
Ok, now it works ... i made confusion with different Designers open of the same Page... I'm sorry, I'm a noob at this, thank you all for your help!
One last thing: Why do I have to insert Work Date? Is it important?0 -
Shimone wrote:One last thing: Why do I have to insert Work Date? Is it important?0
-
I may not have understood the problem well, but coming to your original issue, like "not able to read the value of the variable DateSupportTo from the Page". I did something similar on page 95,
1. Declared a variable DateSupportTo as Date
2. Added it to the last field in the subform page
3. Created a Local function (DateSupportTo - in the properties select Local as Yes) and
4. added the following code to the function:
IF DateSupportTo = TODAY() THEN
MESSAGE('Date entered is Today!');
It works for me. I am not sure what you want to do with the storing part of the situation, but I guess if you can get the value you can always store it wherever you want to..
Was this what you wanted?0 -
It's not exactly what I wanted but it's interesting, thank you very much :-)
There is another problem now ](*,) ...
Whene I create a new line in P95 (Sales wuote subform) and I compile the value of the field Date Supporto, the entry that I create in the Sales Comment Line with the code I wrote some posts ago (and that I copy here) is created with Document Line No. = 0, and not equal to the value of the line document.IF Commenti2.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN Commenti2.Comment:= DateSupporto; Commenti2.MODIFY; END ELSE BEGIN Commenti2.INIT; Commenti2."Document Type":= "Document Type"; Commenti2."No.":= "Document No."; Commenti2."Document Line No.":= "Line No."; Commenti2."Line No." := 10000; Commenti2.Comment:=DateSupporto; Commenti2.INSERT END;
Is it that when you create a new line in any document the Document Line is equal to zero? Damn!0 -
It means that the line no. is not yet assigned when you added the value in DateSupporto field..
first insert all details and move cursor to next line or previos line and then insert the DateSupporto value..and check0 -
mohana_cse06 wrote:It means that the line no. is not yet assigned when you added the value in DateSupporto field..
first insert all details and move cursor to next line or previos line and then insert the DateSupporto value..and check
Yes you are right... but it is so uncomfortable! It overwrite the comment of header :-(...
I modified the code to avoid this:IF Commenti2.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN IF "Line No." <> 0 THEN BEGIN Commenti2.Comment:= DateSupporto; Commenti2.MODIFY; END ELSE DateSupporto := '' END ELSE BEGIN Commenti2.INIT; Commenti2."Document Type":= "Document Type"; Commenti2."No.":= "Document No."; Commenti2."Document Line No.":= "Line No."; Commenti2."Line No." := 10000; Commenti2.Comment:= DateSupporto; Commenti2.INSERT END;
But it remains uncomfortable.... any better ideas? :-k0 -
Shimone wrote:But it remains uncomfortable.... any better ideas? :-k0
-
mohana_cse06 wrote:Shimone wrote:But it remains uncomfortable.... any better ideas? :-k
LOl
In fact there is a bug.. if you :
-select one line (for example the first line)
-click Line-->Comment
-select another line (for example second line)
-click Line-->Comment
It opens the comment for the first line!!!! You have to click Comment again to get the right ones!0 -
Shimone wrote:In fact there is a bug.. if you :
-select one line (for example the first line)
-click Line-->Comment
-select another line (for example second line)
-click Line-->Comment
It opens the comment for the first line!!!! You have to click Comment again to get the right ones!
If you are using standard navision..0 -
Shimone wrote:It's not exactly what I wanted but it's interesting, thank you very much :-)
There is another problem now ](*,) ...
Whene I create a new line in P95 (Sales wuote subform) and I compile the value of the field Date Supporto, the entry that I create in the Sales Comment Line with the code I wrote some posts ago (and that I copy here) is created with Document Line No. = 0, and not equal to the value of the line document.IF Commenti2.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN Commenti2.Comment:= DateSupporto; Commenti2.MODIFY; END ELSE BEGIN Commenti2.INIT; Commenti2."Document Type":= "Document Type"; Commenti2."No.":= "Document No."; Commenti2."Document Line No.":= "Line No."; Commenti2."Line No." := 10000; Commenti2.Comment:=DateSupporto; Commenti2.INSERT END;
Is it that when you create a new line in any document the Document Line is equal to zero? Damn!0 -
Your requirement is similar to Shortcut Dimension functionality in gen. journal lines. You can have a look at this.
A few times I implemented similar solutions and basically you have to do the following:
Create a temporary record after the validation of your variable (if line hasn't been inserted)
Copy temporary record to normal record after the line's insertion.Ufuk Asci
Pargesoft0 -
ufuk wrote:Your requirement is similar to Shortcut Dimension functionality in gen. journal lines. You can have a look at this.
A few times I implemented similar solutions and basically you have to do the following:
Create a temporary record after the validation of your variable (if line hasn't been inserted)
Copy temporary record to normal record after the line's insertion.
Where is created the temporary record? In a record variable?
And how can I find the correct "Document Line No."?0 -
Create 3 functions in the page. Call InsertComment function OnInsertRecord and OnValidate of DateSupporto field.
1)InsertCommentIF "Line No." = 0 THEN SaveToTempComment ELSE CopyFromTempComment;
2) SaveToTempCommentIF TempSalesCommentLine.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN TempSalesCommentLine.Comment:= DateSupporto; TempSalesCommentLine.MODIFY; END ELSE BEGIN TempSalesCommentLine.INIT; TempSalesCommentLine."Document Type":= "Document Type"; TempSalesCommentLine."No.":= "Document No."; TempSalesCommentLine."Document Line No.":= "Line No."; TempSalesCommentLine."Line No." := 10000; TempSalesCommentLine.Comment:=DateSupporto; TempSalesCommentLine.INSERT END;
3) CopyFromTempCommentIF TempSalesCommentLine.GET("Document Type","Document No.",0,10000) THEN BEGIN SalesCommentLine := TempSalesCommentLine; SalesCommentLine."Document Line No." := "Line No."; SalesCommentLine.INSERT; TempSalesCommentLine.DELETE; END;
This code is only for give an idea on how to insert. You have to check it and modify upon your case. Also, you may require writing additional code to display your variable properly.Ufuk Asci
Pargesoft0 -
ufuk wrote:Create 3 functions in the page. Call InsertComment function OnInsertRecord and OnValidate of DateSupporto field.
1)InsertCommentIF "Line No." = 0 THEN SaveToTempComment ELSE CopyFromTempComment;
2) SaveToTempCommentIF TempSalesCommentLine.GET("Document Type","Document No.","Line No.",10000) THEN BEGIN TempSalesCommentLine.Comment:= DateSupporto; TempSalesCommentLine.MODIFY; END ELSE BEGIN TempSalesCommentLine.INIT; TempSalesCommentLine."Document Type":= "Document Type"; TempSalesCommentLine."No.":= "Document No."; TempSalesCommentLine."Document Line No.":= "Line No."; TempSalesCommentLine."Line No." := 10000; TempSalesCommentLine.Comment:=DateSupporto; TempSalesCommentLine.INSERT END;
3) CopyFromTempCommentIF TempSalesCommentLine.GET("Document Type","Document No.",0,10000) THEN BEGIN SalesCommentLine := TempSalesCommentLine; SalesCommentLine."Document Line No." := "Line No."; SalesCommentLine.INSERT; TempSalesCommentLine.DELETE; END;
This code is only for give an idea on how to insert. You have to check it and modify upon your case. Also, you may require writing additional code to display your variable properly.
It's clever! But...
...in the end my boss decided to create new fields in table in the end :-)
Thank you very much, everybody0
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