Problem in Form!!!

Warfox
Member Posts: 53
Hello all,
i have got an problem in a form, i want the onaftergetrecord trigger to run only once on opening the form, but later when you scroll through your lines it should run every time.
THX 4 Help
i have got an problem in a form, i want the onaftergetrecord trigger to run only once on opening the form, but later when you scroll through your lines it should run every time.
THX 4 Help
0
Comments
-
you cannot change when... What do you want to do?0
-
Maybe you can use a global variable wich you set when your code
has run once. The code will only run when it's false (Boolean is default False), after the code has run you set the variable on true, so it won't run again.0 -
But when will i change back the boolean?0
-
WHAT DO YOU WANT TO DO??? Without details I cannot help you... OnAfterGetRecord is called when row is read from DB. On open form is for each row in cache, after scrolling for each new record etc.... why you need to call it only once? Why do you need to call it after that?????? :?: :?: :?: Still too much question without answers... :?0
-
It´s hard to describe, but i´ll try. I have got an array which i have to fill with the first record on the table when the form is opened. Later, when the user scrolls in the record, i have to modify the array again and again.
But i have nearly solved the problem...0 -
the array is something as record history? What do you mean with "the user scrolls in the record"? it means, that user select this record again? What you change in array? Why not use OnAfterGetCurrentRecord?
I am still asking, I know, but my brain is working and there are many solutions for many things... 8)0 -
Like kine said. If you need a solution or at least a lot of (good) ideas, it's better to describe what do you really want to achieve.
Sometimes a man cannot see a solution because he's looking to close.®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
In fact it doesn´t matter what i want to do, because that what i want to do with the array works perfectliy, what i need is an idea how i can run the code in the on aftergetrecord trigger once, when i open the form. Because there are displayed 4 records in the the list, so the on aftergetrecord is executed 4 times, so the pointer is on the first record of the list and the according data in the array is for the last record in the list. Because i fill the array in the on aftergetrecord.
The programm is too complex for describing it here, sorry.0 -
I will join the rest of the guys who answered you, Warfox. Simply use a global variable on the form e.g. a boolean. Set it to true the first time you retrieve the record and set up a if-condition for the rest of your trigger code based on that boolean. The value of the variable lives as long as the form lives.
Regards,
Ole0 -
If you only need to have last record in Array, why not do "
MyRec.COPY(Rec); MyRec.FIND('+'); array blablablablabla..... //there can I do something with last rec in form...
0 -
thx oleschjoeth, but can you tell me on which trigger i have to set the boolean back. No kine i have to need the first record, but with a find ('-') it doesn´t work *g* i have nearly solved the problem by using an integer counter but it doesn´t work perfectly.0
-
Still, i have no information to be able help you. If you can't tell us what do you want to do, I am not able to help you. I can only guess the answer for your question...
sorry:?:
0 -
Warfox, why would you want to set it back? As Kine says, if you don't want to tell us what you are trying to achieve it's very difficult to help you. Me might suggest a solution that won't work for you because we see your problem out of context due to your lack of information
Ole0 -
Try to put your code in the OnAfterGetCurrRecord-Trigger.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
hy, good news, i´ve solved it.
It was a little bit difficult, but here is the code:
Form - OnopenForm
openform := TRUE;
counter2 := 0;
records := 4; //The records that can be shown in the form at one time
Form - OnAfterGetRecord()
CALCFIELDS(Splittcount);
CALCFIELDS("Finished Positions");
CALCFIELDS("Position Finished");
counter2 := counter2 + 1;
IF (counter2 = 1) OR (openform = FALSE) THEN BEGIN
FOR counter := 1 TO 4 DO BEGIN
Split.RESET;
Split.SETRANGE("Picknr.","Picknr.");
Split.SETRANGE("Zeilennr.","Zeilennr.");
Split.SETRANGE("Fachnr.", STRSUBSTNO('%1',counter));
IF Split.FIND('-') THEN BEGIN
Amount[counter][1] := Split.Menge;
IF Split.Menge = 0 THEN
Amount[counter][1] := Split."Bestellte Menge";
Amount[counter][2] := Split."Bestellte Menge";
Textfield[counter][1] := STRSUBSTNO('%1',Amount[counter][1]);
Textfield[counter][2] := STRSUBSTNO('Filiale:\%1',Split.Filliale);
END ELSE BEGIN
Amount[counter][1] := 0;
Amount[counter][2] := 0;
Textfield[counter][1] := STRSUBSTNO('%1',Amount[counter][1]);
Textfield[counter][2] := '';
END;
END;
END;
IF counter2 >= records THEN
openform := FALSE;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