mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 3:45 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [Solved] Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 5:25 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I created a dataport to bring in some data from a csv file. The dataport seems to work( it goes to 100%), it bring in all the data i want. I can see the data I brought in the FA Journal Line Table. But its not showing up in the FA Journal Line form. Any ideas why it might be doing that?

I thought the form is used to show the data that is presented in the table. I have no idea why its not coming in the form.


Last edited by nverma on Wed Apr 25, 2012 6:18 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 5:53 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
Did you view the keys of table FA Journal Line (5621)?

Did you fill Journal Template Name & Journal Batch Name or did you think those were unnecessary?

Again.....
You can enter a line in the journal & export it using your dataport to see how the data should look.
& import 1 line & manually enter 1 line and compare them. If you dataport fills in all the fields that the manual entry does then your on the right track. It they don't match then your dataport is not ready to use!

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Last edited by Savatage on Wed Apr 25, 2012 5:56 pm, edited 1 time in total.

Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 5:54 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3293
Location: Wilrijk
Country: Belgium (be)
Verify if the fields "Journal Template Name" and "Journal Batch Name" in table "FA Journal Line" have the same values as your FA Journal form filters.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:01 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
This is the code I wrote for the Dataport and It should answer all your questions.
Code: Select all
[b]FA Journal Line- OnPreDateItem()[/b]
IF CurrDataport.IMPORT THEN BEGIN
  REPEAT
    CurrFile.READ(cha);
  UNTIL cha = 10; // of course in case the RecordSeparator is "<<NewLine>>"
END;

FAJournalLine.SETRANGE("Journal Template Name", FAJournalBatch."Journal Template Name");
FAJournalLine.SETRANGE("Journal Batch Name", FAJournalBatch.Name);
//FAJournalLine.SETFILTER("Journal Template Name", 'ASSETS');
//FAJournalLine.SETFILTER("Journal Batch Name", 'DEFAULT');

// If the payment journal currently contains lines, then get the last line no., and start inserting
// payment journal lines from that point forward.
IF FAJournalLine.FIND('+') = TRUE THEN
  LastLineNo := FAJournalLine."Line No."

// Otherwise, start the line no. at zero
ELSE
  LastLineNo := 0;

[b]FA Journal Line - OnBeforeImportRecord()[/b]// OMODNV01 - ADD Start
// Clear variables so that values are not replicating across multiple import lines
CLEAR(FAPostingDate);
CLEAR(DocumentNo);
CLEAR(FANo);
CLEAR(DepreciationBookCode);
CLEAR(FAPostingType);
CLEAR(Description);
CLEAR(Amount);
CLEAR(CostCenterCode);
CLEAR(FundNo);
CLEAR(ControlFundNo);
// OMODNV01 - ADD End

[b]FA Journal Line - OnAfterImportRecord()[/b]// OMODNV01 - ADD Start
// Initialize the template and batch names
FAJournalLine.INIT;

FAJournalLine.SETRANGE("Journal Template Name", FAJournalBatch."Journal Template Name");
FAJournalLine.SETRANGE("Journal Batch Name", FAJournalBatch.Name);

//FAJournalLine.SETFILTER("Journal Template Name", 'ASSETS');
//FAJournalLine.SETFILTER("Journal Batch Name", 'DEFAULT');

LastLineNo += 10000;
FAJournalLine."Line No." := LastLineNo;

FAJournalLine."FA Posting Date" := FAPostingDate;
FAJournalLine."Document No." := DocumentNo;
FAJournalLine."FA No." := FANo;
FAJournalLine."Depreciation Book Code" := DepreciationBookCode;

CASE FAPostingType OF
  'Acquisition Cost':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::"Acquisition Cost";
  'Depreciation':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::Depreciation;
  'Write-Down':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::"Write-Down";
  'Appreciation':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::Appreciation;
  'Custom 1':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::"Custom 1";
  'Custom 2':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::"Custom 2";
  'Disposal':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::Disposal;
  'Maintenance':
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::Maintenance;
ELSE
    FAJournalLine."FA Posting Type" := FAJournalLine."FA Posting Type"::"Salvage Value";
   
END;

FAJournalLine.Description := Description;
FAJournalLine.Amount := Amount;

// Get the cost center and fund data from the dataport line
FAJournalLine.VALIDATE("Cost Center Code", CostCenterCode);
FAJournalLine."Control Fund No." := 'OPER';
FAJournalLine.INSERT;


Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:05 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3293
Location: Wilrijk
Country: Belgium (be)
See my previous posting. I have nothing to add.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:09 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I am looking at the data it imported to FA Journal Table and I noticed that the Journal Template Name and Journal Batch name are left blank.

I think that might be reason its not showing up in the FA Journal Line form.

Any Idea why it might be doing that.

Originally I had this:
FAJournalLine.SETFILTER("Journal Template Name", 'ASSETS');

Shoudlnt it set the Journal Template Name to ASSETS automatically? This might seem like a stupid question


Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:15 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3293
Location: Wilrijk
Country: Belgium (be)
SETFILTER or SETRANGE are used to filter your records, not to assign fieldvalues. You should assign the proper values to all key fields yourself.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:17 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
hmmm...that is so strange....I manually assigned the Journal Template Name and Journal Batch Name and it worked.

FAJournalLine."Journal Template Name" := 'ASSETS';
FAJournalLine."Journal Batch Name" := 'DEFAULT';

hmmm....OK. I guess that makes sense...Thanks.. I learned something new today.


Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:29 pm 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
If you would have used insert(true),you could have found that the template and batch are inserting or not.
anyway now it has been solved.

Congrats Harry for reaching his fantastic figure(6666). =D>

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


Last edited by vijay_g on Thu May 03, 2012 1:25 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:37 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
vijay_g wrote:
If you would have used insert(true),you could have found that the template and batch are inserting or not.

I don't think that has anything to do with it. The lines imported so there was no question whether they were inserted, they were just imported without a template and batch number. The OnInsert checks for valid templates and batches, and they could have been there with blank values.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:53 pm 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
You are right that the record can be inserted without template or batch having only line no. incremental but this is the line that would stop to insert record.
Code: Select all
FAJnlTemplate.GET("Journal Template Name");

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


Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 6:59 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
If there is a template with a blank Name it would not stop the insert, and it is quite common to have those.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 7:24 pm 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
Yes it would not stop to insert but where do we need to have those....?
DenSter wrote:
and it is quite common to have those.

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


Top
 Profile E-mail  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 8:00 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
The point is, your advice that INSERT(TRUE) would catch them is not correct.

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Dataport does not fill form, but fills table????
PostPosted: Wed Apr 25, 2012 9:56 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
Savatage wrote:
Did you fill Journal Template Name & Journal Batch Name or did you think those were unnecessary?
Quote:
nverma wrote:
I am looking at the data it imported to FA Journal Table and I noticed that the Journal Template Name and Journal Batch name are left blank.

Luc Van Dyck wrote:
SETFILTER or SETRANGE are used to filter your records, not to assign fieldvalues. You should assign the proper values to all key fields yourself.

nverma wrote:
hmmm...that is so strange....I manually assigned the Journal Template Name and Journal Batch Name and it worked.

sums it up. :thumbsup:

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 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: