mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 1:54 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Fetching data in header and line table based on text box
PostPosted: Sat Jun 09, 2012 10:54 am 
Offline

Joined: Mon Jan 02, 2012 7:34 am
Posts: 30
Country: India (in)
Hi,
Can any body give me idea on this. I have form based on the tables similar to sales header and sales line which contains data in it. But the requirement is that , when we open form, we should not able to see any records in it. User will be given one text box in which users enters the primary key of that table then data from both in header and line should be fetched. can any body give me idea how to achieve this


Top
 Profile E-mail  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Sat Jun 09, 2012 11:38 am 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
Why you want to do this and what you have tried as of now?

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


Top
 Profile E-mail  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Sat Jun 09, 2012 12:14 pm 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
Look at the General Journal form as a place to start. Where the Batch Name is you could set this to blank or some value which will never exist each time the form is opened. Then this would be where the user enters or even looks up the record they want to display.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Sat Jun 09, 2012 2:52 pm 
Offline

Joined: Mon Jan 02, 2012 7:34 am
Posts: 30
Country: India (in)
this code in general journal is not working in the above forms

GenJnlLine.FILTERGROUP := 2;
GenJnlLine.SETRANGE("Journal Batch Name",CurrentJnlBatchName);
GenJnlLine.FILTERGROUP := 0;

can any body suggest how to block showing of all records when form is opened or until that primary key is specified


Top
 Profile E-mail  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Sat Jun 09, 2012 6:47 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)
We have a form that has 1 textbox where an PO# is entered (scanned into)

It searchs the sales orders and if it finds a match it bings up that order.
If it doesn't find a match it then searches the posted invoices.
If it finds a match it then brings up that invoice.
else it says order not found.

We call it our quick search form.
Sounds like you are looking for something like that. or you can study the code to see how it works and then implement your own.

InvCount->Integer
SalesInvoiceHeader->Record->Sales Invoice Header
SalesHeader->Record->SalesHeader
ScanOrderNo->Code20
SalesForm->Form->Sales Order
InvoiceForm->Form->Posted Sales Invoice
SourceExp of textbox = ScanOrderNo

Code: Select all
OnAfterValidate() of the textbox
IF ScanOrderNo = ''
THEN BEGIN
MESSAGE('You Cannot Search A Blank Number!');
END ELSE BEGIN
SalesHeader.SETCURRENTKEY("Document Type","No.");
SalesHeader.SETRANGE("External Document No.",ScanOrderNo);
IF SalesHeader.FIND('-') THEN REPEAT
  InvCount := InvCount +1;
UNTIL SalesHeader.NEXT = 0;
IF SalesHeader.FIND('+')  THEN BEGIN
  MESSAGE('Number Of Open Order(s) Found= %1',InvCount);
  CLEAR(SalesForm);       
  SalesForm.LOOKUPMODE(TRUE);
  SalesForm.SETTABLEVIEW(SalesHeader);
  SalesForm.RUNMODAL;
  CLEAR(ScanOrderNo);
END ELSE BEGIN
SalesInvoiceHeader.SETCURRENTKEY("Sell-to Customer No.","External Document No.");
SalesInvoiceHeader.SETRANGE("External Document No.",ScanOrderNo);
IF SalesInvoiceHeader.FIND('-') THEN REPEAT
  InvCount := InvCount +1;
UNTIL SalesInvoiceHeader.NEXT = 0;
IF SalesInvoiceHeader.FIND('+') THEN BEGIN
  MESSAGE('Number Of Posted Order(s) Found= %1',InvCount);
  CLEAR(InvoiceForm);
  InvoiceForm.LOOKUPMODE(TRUE);
  InvoiceForm.SETTABLEVIEW(SalesInvoiceHeader);
  InvoiceForm.RUNMODAL;
  CLEAR(ScanOrderNo);
END ELSE BEGIN
MESSAGE('Order Not Found');
CLEAR(ScanOrderNo);
CurrForm.UPDATE;
END;
END;
END;
CLEAR(InvCount);

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Mon Jun 11, 2012 7:41 am 
Offline

Joined: Mon Jan 02, 2012 7:34 am
Posts: 30
Country: India (in)
Can't we do in one form, above code requires two forms


Top
 Profile E-mail  
 
 Post subject: Re: Fetching data in header and line table based on text box
PostPosted: Mon Jun 11, 2012 3:59 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)
It's one form with 1 textbox - then if calls already existing forms to pull the order you are looking for.

now that's just an example - I don't know the exact requirement you are trying solve.

I happen to put the textbox on a seperate form but you can try it anywhere you like.
All the code is OnAfterValidate of the textbox so it's all inclosed in one thing.

We use it to search posted & non posted orders - you might not need this - so you can use snipits if you like - it was just an example.

_________________
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  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Jascha Vincke 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: