mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 6:08 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Copy Job Error
PostPosted: Mon May 07, 2012 7:39 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
primary key: basically its a unique identity for each record. Its the first key in the keys menue. It is used to differenciate between two records.

Thast all i remember.


Top
 Profile E-mail  
 
 Post subject: Re: Copy Job Error
PostPosted: Mon May 07, 2012 8:13 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
Basically, this is what my manager told me and I need to write code to for this:
"If the Program Setup contains default Job Task No. then don't even add the job tasks from the job to be copied.
If the new job doesn't have a job task defined, only then do you copy the job task from the job to be copied
If the new job contains job tasks (done through Program Setup), then you skip copying job tasks"

Now I sorta, know where I am going.

This is sorta off topic, how do you delete a message in a post??? Is that even possible?


Top
 Profile E-mail  
 
 Post subject: Re: Copy Job Error
PostPosted: Mon May 07, 2012 10:23 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
Well that makes absolutely no sense at all. Of course the new job is not going to have a job task. It's a new job, so it doesn't have anything attached to it when it is created. You must be working in a database that has customizations in there.

The reason why I am asking about primary key is because if you really understand that, you will also understand how filters on a compound primary key will affect what you need to take care of for a new job. The job task are related to the job by way of the job number, so when you copy a job task from one job to another, all you need to do in the new job task is use the new job number.

Filter on the old job number, loop, copy the record and change the job number, insert.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Copy Job Error
PostPosted: Tue May 08, 2012 4:44 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
You are right, there have been a lot of customization's done for this client.
For Instance, when a user creates a job card, it will automatically fill it with a default information for job task (Thats why when a job a created it will have a default job task no., Cost Center Code, etc)

From the requirements my manager told me to do: I wrote this code and I thought it should have worked, but its not working. I have tried debugging it 5-6 times, but debugger keeps on crashing.

Code: Select all
JobTask.SETRANGE("Job No.", CurrentJob."No.");
IF JobTask.FIND('-') = TRUE THEN
REPEAT
   ProgramSetup.GET(CurrentJob."Program");
   NewJobTask.SETRANGE("Job No.", JobTask."Job No.");
   IF NewJobTask."Job Task No." = ProgramSetup."Default Job Task No." THEN
     CLEAR(NewJobTask."Job Task No.")
   ELSE
   begin
     NewJobTask.INIT;
     NewJobTask.TRANSFERFIELDS(JobTask);
     NewJobTask."Job No." := lrecNewJob."No.";
     NewJobTask.INSERT
   end;       
UNTIL JobTask.NEXT = 0;


Any idea what might be causing the debugger to crash. I am pretty sure there is a flaw in my logic somewhere.


Top
 Profile E-mail  
 
 Post subject: Re: Copy Job Error
PostPosted: Tue May 08, 2012 5:03 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
I'm sorry, I can't help you there. There can be a bunch of things, and to troubleshoot that you really need to have direct access to the screen. This is where you would sit down with your senior and step through the code together and troubleshoot what you see.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Copy Job Error
PostPosted: Tue May 08, 2012 5:16 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
Ok. :)

Just one last question (I refuse to give you on this):
According to my manager this is what needs to be done. I have read these lines like atleast 50 times, I just want to run by you what I understood and you can tell me if I am on the right path.

1) "If the Program Setup contains default Job Task No. then don't even add the job tasks from the job to be copied. --> If ProgramSetup has a default Job Task No. assigned to it, then we should not copy any Job tasks

2) If the new job doesn't have a job task defined, only then do you copy the job task from the job to be copied --> This will never be the case, since when we create a job, it will always has a default job tasks, so I dont have to copy anything since it will never be empty (doesnt have job task). I am not really sure about this point.

3) If the new job contains job tasks (done through Program Setup), then you skip copying job tasks" --> This is basically the same thing as 1


Top
 Profile E-mail  
 
 Post subject: Re: Copy Job Error
PostPosted: Tue May 08, 2012 6:56 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
If your manager gives you a requirement that you don't understand, you should not be asking ME to clarify. Go to the source and have them explain it, and explain it again, until you understand what they mean.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Copy Job Error
PostPosted: Tue May 08, 2012 7:44 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
That actually makes senses...hehehe.... :mrgreen:


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 5 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:  
cron