mibuso.com

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

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Use the SourceTableTemporary property.
PostPosted: Tue Aug 07, 2007 10:37 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Tue Jul 19, 2005 4:49 pm
Posts: 3836
Location: Olst
Country: Netherlands (nl)
The SourceTableTemporary is a new property introduced in 5.0 giving all kinds of new capabilities of showing data that is not even in the database.

Instead of showing real data from the database, the form is running on an empty table when starting up, so you will have to populate it with data.

Step 1.

Create a normal form with the wizard and define your sourcetable. Select the columns you want to (ab)use.

Make sure to select the SourceTableTemporary property.

In our example we will use table 18, Customer and select columns No. and Name.

Step 2.

Create a new function "InitTempTable"

In this function define a Local variable "Cust", type Record, Subtype 18. (Customer).

Write the following piece of C/AL Code

Code: Select all
Cust.SETFILTER(Balance, '>1000');
Cust.SETFILTER("Country/Region Code" , 'NL');
If Cust.FINDSET THEN REPEAT
  Rec := Cust;
  INSERT;
UNTIL Cust.NEXT = 0;

Cust.SETFILTER(Balance, '>500');
Cust.SETFILTER("Country/Region Code" , '<>NL');
If Cust.FINDSET THEN REPEAT
  Rec := Cust;
  INSERT;
UNTIL Cust.NEXT = 0;


Step 3

Go to the OnOpenForm trigger and put the new function in there.

Result

A view of your customers with a filter that is normaly not possible with the normal filters still available.

The idea and example are from form 634 Chart of Accounts Overview in 5.0. You'll also find a great example there of how to expand and collapse.

For a customer I've built a view combining 2 tables based on a date filter with quantities summed up from other tables. It is very easy to use and setup and when using proper indexing the performance is perfect.

Good luck.


Top
 Profile E-mail WWW  
 
 Post subject: Hi Mark
PostPosted: Wed Aug 08, 2007 9:22 am 
Offline

Joined: Tue Aug 07, 2007 11:06 am
Posts: 22
Location: New Delhi
Country: India (in)
Nice meeting you.

This is Kiran. I have verified in my database with hotfix nav5.00 the form property you specified 'sourcetabletemporary' . But, I did't get that in my database version 4.00 SP3.

Let please know to me about the Property with any .fob file.

Kiran.

_________________
Hi


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 9:36 am 
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)
As Mark already explained, this property is only available starting from Dynamics NAV 5.0.

_________________
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:
PostPosted: Wed Aug 29, 2007 1:48 pm 
Offline

Joined: Sat Mar 18, 2006 2:53 am
Posts: 415
Location: St. Helier, Jersey
Country: Jersey (je)
You can run similar funcionality in 4.x but you have to:

1. Create variable based on record of your interest
2. Set the TEMPORARY property of variable to YES
3. Fill temporary variable with data
4. Run the form using syntax:

Code: Select all
FORM.RUN(FORM::"YourFormHere",YourTempRecVariable);


Regards,
Slawek


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 29, 2007 2:14 pm 
Offline

Joined: Sat Mar 10, 2001 8:01 am
Posts: 117
Location: Waiblingen / Germany
Country: Germany (de)
Slawek Guzek wrote:
You can run similar funcionality in 4.x but you have to:

1. Create variable based on record of your interest
2. Set the TEMPORARY property of variable to YES
3. Fill temporary variable with data
4. Run the form using syntax:

Code: Select all
FORM.RUN(FORM::"YourFormHere",YourTempRecVariable);


Regards,
Slawek

You are right, to be found in codeunit 1 function SetGlobalLanguage

_________________
Torsten
MCP+I, MCSE NT, Navision MCT (2004,2005)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 03, 2007 5:00 pm 
Offline

Joined: Tue Apr 11, 2006 10:00 pm
Posts: 1187
Location: Vienna
Country: Austria (at)
Some additional info:

Of course if you don't want to hardcode the filters you'll need to DELETEALL and re-populate the temp table. But the problem is that some genius might change SourceTableTemporary to NO and boom, your table is nuked, hope you have a backup from yesterday. So IMHO you should never DELETALL a temporary table. In the usual cases you can solve it by making it local to a function but not in this case. So what to do? My solution is to use a processing-only report where the user can set the filters the usual way, then the report will populate the temp table and run the form on it. No further processing on the form therefore no need to DELETEALL.

_________________
Sorry, no support using PM, e-mail or MSN - please use this forum.


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Tue Jan 26, 2010 12:58 pm 
Offline

Joined: Tue Jan 16, 2007 12:41 pm
Posts: 56
Location: Southampton
Country: United Kingdom (uk)
Deleting Records:

So I was using this property for the first time today and found out a bit of an issue with deleting.

When you delete a temporary record it runs all the code on the delete trigger of the record. So in my case the form was bases on the item table, when I deleted the temporary record it didn't delete the actual item record but it did delete any related data. So in my test case it deleted all the comments associated with the item.

To stop this I put the following code on the form:
Form - OnDeleteRecord() : Boolean
DELETE(FALSE);
EXIT(FALSE);

I think that's ok, if someone has a better solution please let me know :-)


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Tue Jan 26, 2010 1:06 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
be aware that the same does happen for other triggers,too (validates, insert, modify...)

_________________
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Tue May 18, 2010 8:39 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
sawyeresbitt wrote:
Are always empty can only temporarily (ie in the working memory of the client) to use when booking, and property "Temporary" = Yes must be specified but in Recordvariable anyway.

sorry, i didn't get you :-k ...is it a question?if so, can you explain it in detail, please?

_________________
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog


Top
 Profile  
 
 Post subject: Re:
PostPosted: Wed Jun 16, 2010 9:09 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
Miklos Hollender wrote:
Some additional info:

Of course if you don't want to hardcode the filters you'll need to DELETEALL and re-populate the temp table. But the problem is that some genius might change SourceTableTemporary to NO and boom, your table is nuked, hope you have a backup from yesterday. So IMHO you should never DELETALL a temporary table. In the usual cases you can solve it by making it local to a function but not in this case. So what to do? My solution is to use a processing-only report where the user can set the filters the usual way, then the report will populate the temp table and run the form on it. No further processing on the form therefore no need to DELETEALL.

I do it the same way, but i've got a small (probably big) problem: i have to call some functions before running the form (page in my case, but it's not important), thus i have to declare the form as a variable in order to call the functions and run the form with the same instance...i still can't find a proper function to set a temptable variable as the form variable sourcetable:
settableview --> useless, it just sets the filters
setrecord --> useless, it just sets the "focus"
any idea?am i missing some parameter, maybe?
Thanks in advance

_________________
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Wed Jun 16, 2010 9:17 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
F**k off!!(sorry, but i'm really disappointed)i guess i can't :evil: :evil:
http://www.mibuso.com/forum/viewtopic.php?f=23&t=38328

_________________
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Thu Jun 17, 2010 2:14 pm 
Online
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7496
Location: Milan
Country: Italy (it)
Little trick to send parameters to a form even if you use FORM.RUNMODAL or FORM.RUN.

-create a singleinstance codeunit with 2 functions: "SaveInfo" and "GetInfo".

Before running FORM.RUNMODAL, run the function "SaveInfo" in which you pass your parameter you want to give to the form
In the OnOpenForm of your form, run function GetInfo that returns the parameter you just saved in the SingleInstance codeunit.

I use this technique VERY often.

_________________
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  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Thu Jun 17, 2010 2:38 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
OMG!!! =D>
You're OUTSTANDING!

_________________
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog


Top
 Profile  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Thu Jun 17, 2010 2:59 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5315
Location: Prague
Country: Czech Republic (cz)
Belias wrote:
sorry, i didn't get you :-k ...is it a question?if so, can you explain it in detail, please?


He He just a busy day for spammers today.

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Use the SourceTableTemporary property.
PostPosted: Thu Jun 17, 2010 5:52 pm 
Offline

Joined: Mon May 18, 2009 6:36 am
Posts: 792
Location: India
Country: India (in)
kriki wrote:
Little trick to send parameters to a form even if you use FORM.RUNMODAL or FORM.RUN.

-create a singleinstance codeunit with 2 functions: "SaveInfo" and "GetInfo".

Before running FORM.RUNMODAL, run the function "SaveInfo" in which you pass your parameter you want to give to the form
In the OnOpenForm of your form, run function GetInfo that returns the parameter you just saved in the SingleInstance codeunit.

I use this technique VERY often.



if you want to send parameter to a form just take a variable type FORM and create a function in form to be run, before running form call this function and you can send parameter to form.
in this case form also holds values given by report.

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


Last edited by vijay_g on Fri Jun 18, 2010 4:12 pm, edited 1 time in total.

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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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: