mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 19, 2013 7:00 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: records modifications
PostPosted: Mon Mar 26, 2012 7:05 pm 
Offline

Joined: Wed Apr 20, 2011 6:27 pm
Posts: 166
Country: Tunisia (tn)
Hi all,
I have a table with many lines. Only the "Entry No." is diffrent between lines.
I have many identical lines 2 by 2, only the "Entry No." is diffrent.
And I want to modify every second line of these 2 lines.
I hope that u understand what I want to do.
I created a report but it changes the 2 lines.
Thanks


Top
 Profile E-mail  
 
 Post subject: Re: records modifications
PostPosted: Mon Mar 26, 2012 9:52 pm 
Offline

Joined: Wed May 16, 2007 6:35 pm
Posts: 108
Location: Ellesmere Port
Country: United Kingdom (uk)
Hi sbilly

You can have something like...

loop := 0
IF EntryRec.FINDFIRST then
repeat
loop += 1;
IF (loop MOD 2) = 0 THEN
//modify 2nd record code

until EntryRec.NEXT = 0;


Good luck

_________________
Big D signing off!


Top
 Profile  
 
 Post subject: Re: records modifications
PostPosted: Mon Mar 26, 2012 10:14 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5315
Location: Prague
Country: Czech Republic (cz)
sbilly wrote:
Hi all,
I have a table with many lines. Only the "Entry No." is diffrent between lines.
I have many identical lines 2 by 2, only the "Entry No." is diffrent.
And I want to modify every second line of these 2 lines.
I hope that u understand what I want to do.
I created a report but it changes the 2 lines.
Thanks


[-X

sbilly, you should never be modifying entry tables directly.

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: records modifications
PostPosted: Mon Mar 26, 2012 11:05 pm 
Offline

Joined: Wed May 16, 2007 6:35 pm
Posts: 108
Location: Ellesmere Port
Country: United Kingdom (uk)
Hi sbilly

You didn't mention Entry tables did you :)!

Good luck

_________________
Big D signing off!


Top
 Profile  
 
 Post subject: Re: records modifications
PostPosted: Tue Mar 27, 2012 8:11 am 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
Big D wrote:
Hi sbilly

You didn't mention Entry tables did you :)!

Good luck

Is there any other table in navision having entry no. field(other than ledger table)? :-k

_________________
Vijay Gupta
Changing the code is last step. Try to change processes first...


Top
 Profile E-mail  
 
 Post subject: Re: records modifications
PostPosted: Tue Mar 27, 2012 3:22 pm 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7493
Location: Milan
Country: Italy (it)
And using FINDFIRST in a LOOP is not a good idea.

Better would be:

Code: Select all
loop := 0
IF EntryRec.FINDSET(TRUE,TRUE) then
repeat
  loop += 1;
  IF (loop MOD 2) = 0 THEN BEGIN
    EntryRec2 := EntryRec;
    Change EntryRec2;
  END;
until EntryRec.NEXT = 0;

The second TRUE in FINDSET(TRUE,TRUE) + using a second variable is maybe a little overkill, but it is definitely worth it using this technique to avoid possible problems that might arise if not using it. (problems like records that are skipped or changed multiple times,...)

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: