[development-axapta] CommaIO

2007-11-05 Thread paulinavk
I am having a problem creating a commaio file.  I have taken a 
standard Axapta report (TaxWithHoldTrans) and added a write to a text 
file in the execute section.  But when I run it I get a permission 
error when I try to create the new commaio instance - before I even 
get to the write.  I have tried this modifiying the 
tutorial_stdBaseReport and had no problems at all but when I try it on 
the TaxWithHoldTrans it wont let me create it.  Any ideas? 
Regards,
Paulina



Re: [development-axapta] Re: How To Find Persons who born today ? (birthdate)

2007-11-05 Thread Sailendran Rajan
But its better not to use the below code in custumization, unless for a Job. 
Belujins method is recommended.

stuzimmy [EMAIL PROTECTED] wrote:  The following code will find users 
who's month and day match today's 
month and day. It runs a sql statement against the database. 
Good luck.

Connection Con = new Connection();
Statement Stmt = Con.createStatement();
ResultSet R = Stmt.executeQuery(SELECT Name,BirthDate from 
EmplTable where month(EmplTable.BirthDate) = month(GetDate()) and day
(EmplTable.BirthDate) = day(GetDate()));
;
while ( R.next() )
{
print R.getString(1);
pause;
}

--- In development-axapta@yahoogroups.com, Max Belugin 
[EMAIL PROTECTED] wrote:

 Add month and day fields and index and update them when birthdate 
changes
 
 
 On 11/1/07, Ali Ýhsan Aðca [EMAIL PROTECTED] wrote:
  Thanks Steffen,
  But I wrote wrong word in my reply message to Rosyee.
  Sufficient must be efficient.
  I know that query will bring me the result but speed will not
  be high as I wish.
  Because all the records will be checked if the person is born 
today in
  code.
  But I want that case be checked by sql server not by axapta.
  Glad to describe my problem to you. (If I could)...
 
  Best Regards...
  Ali Ihsan
 
  --- In development-axapta@yahoogroups.com, Steffen Denize
  steffendenize@ wrote:
  
   Hi Ali
  
   If you change emplTable to contactPerson in the select statement
  from Rosyee
   you will find all persons who have birthday today, no matter how
  many person
   there are in the given table.
  
  
  
   Best regards,
  
   Steffen
  
  
  
   Fra: development-axapta@yahoogroups.com
   [mailto:[EMAIL PROTECTED] PÃ¥ vegne af Ali 
Ýhsan Aðca
   Sendt: 24. oktober 2007 12:52
   Til: development-axapta@yahoogroups.com
   Emne: [development-axapta] Re: How To Find Persons who born 
today ?
   (birthdate)
  
  
  
   Thanks Rosyee,
   But I have to find persons from ContactPerson table.
   And there more than 200.000 records in there.
   And this method will not be sufficient for finding 5 or maybe 
max 10
   person from there.
  
   Best Regards...
   --- In HYPERLINK
  
  mailto:development-axapta%40yahoogroups.comdevelopment-
[EMAIL PROTECTED]
   com, Rosyee rosyee@ wrote:
   
Hi Ali,
   
You can use like this
   
while Select emplTable
{
if( mthofyr(emplTable.BirthDate) == mthofyr(today())
 dayofmth(emplTable.BirthDate) == dayofmth(today()))
{
//u'll get records who born on same day as today
}
}
   
Hope this is what you are looking for.
   
Thanks,
Rosyee
   
   
On 10/24/07, Max Belugin mbelugin@ wrote:

 I'd prefer to extract month and day numbers to separate 
fields.

 But you can use Connection and native queries

 On 10/23/07, Ali Ýhsan Aðca
   aliihsanagca@aliihsanagca%40gmail.com
 wrote:
  I thought so. But I think there must be a way to include 
that
   case in
  query filter string
 
  Thanks...
 
  --- In
   HYPERLINK
  
  mailto:development-axapta%40yahoogroups.comdevelopment-
[EMAIL PROTECTED]
   comdevelopment-axapta%40yahoogroups.com,
 Max Belugin
  mbelugin@ wrote:
  
   I think, the only way is to enumerate dates from today 
back to
   1900.
   (AFAIK there is no way to store dates prior to 1900)
  
   On 10/22/07, Ali Ã#65533;hsan Aðca aliihsanagca@ 
wrote:
I want to find the persons who were born today?
What is the filter for that query?
   
Thanks in advance...
   
   
   
   
Yahoo! Groups Links
   
   
   
   
  
  
   --
   Max Belugin, HYPERLINK
  http://belugin.infohttp://belugin.info ,
   ICQ:9406811
  
 
 
 
 
 
  Yahoo! Groups Links
 
 
 
 

 --
 Max Belugin, 
HYPERLINK http://belugin.infohttp://belugin.info ,
   ICQ:9406811


   
   
[Non-text portions of this message have been removed]
   
  
  
  
  
  
   No virus found in this incoming message.
   Checked by AVG Free Edition.
   Version: 7.5.503 / Virus Database: 269.15.9/1090 - Release Date:
  24-10-2007
   08:48
  
  
   No virus found in this outgoing message.
   Checked by AVG Free Edition.
   Version: 7.5.503 / Virus Database: 269.15.9/1090 - Release Date:
  24-10-2007
   08:48
  
  
  
   [Non-text portions of this message have been removed]
  
 
 
 
 
 
  Yahoo! Groups Links
 
 
 
 
 
 
 -- 
 Max Belugin, http://belugin.info , ICQ:9406811




 

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]



RE: [development-axapta] Re: How To Find Persons who born today ? (birthdate)

2007-11-05 Thread @@mir [EMAIL PROTECTED]
You need to make a class and past this method 
server static void main(Args _args){DictTable  dictTable;Connection 
connection;Statement  statement;strsql;ResultSet  
resultSet;SqlStatementExecutePermission perm;; dictTable = new 
DictTable(tableNum(ContactPerson));if (dictTable != null){  
 connection = new Connection();   sql = strfmt(SELECT Name,BirthDate 
from +ContactPerson where month(ContactPerson.BirthDate) = 
month(GetDate()) and day+(ContactPerson.BirthDate) = 
day(GetDate()));   //Instantiate the permission class   perm = 
new SqlStatementExecutePermission(sql);   //check for permission to use 
statement   perm.assert();   statement = 
connection.createStatement();   resultSet = 
statement.executeQuery(sql);   //end the scope of the assert call   
CodeAccessPermission::revertAssert();while (resultSet.next())   
 {print 'name = ' +resultSet.getString(1)+ ' 
Birthdate= '+resultSet.getString(2);}pause;}}

  
 
 
 
M Amir NazimSoftware Engineer MazikPakistan - Dynamics DivisionEmail : [EMAIL 
PROTECTED]

To: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Fri, 2 Nov 2007 18:17:16 
+Subject: [development-axapta] Re: How To Find Persons who born today ? 
(birthdate)




The following code will find users who's month and day match today's month and 
day. It runs a sql statement against the database. Good luck.Connection Con = 
new Connection();Statement Stmt = Con.createStatement();ResultSet R = 
Stmt.executeQuery(SELECT Name,BirthDate from EmplTable where 
month(EmplTable.BirthDate) = month(GetDate()) and day(EmplTable.BirthDate) = 
day(GetDate()));;while ( R.next() ){print R.getString(1);pause;}--- In 
development-axapta@yahoogroups.com, Max Belugin [EMAIL PROTECTED] wrote: 
Add month and day fields and index and update them when birthdate changes   
On 11/1/07, Ali Ýhsan Aðca [EMAIL PROTECTED] wrote:  Thanks Steffen,  
But I wrote wrong word in my reply message to Rosyee.  Sufficient must be 
efficient.  I know that query will bring me the result but speed will not  
be high as I wish.  Because all the records will be checked if the person is 
born today in  code.  But I want that case be checked by sql server not by 
axapta.  Glad to describe my problem to you. (If I could)...   Best 
Regards...  Ali Ihsan   --- In development-axapta@yahoogroups.com, 
Steffen Denize  steffendenize@ wrote: Hi Ali If you 
change emplTable to contactPerson in the select statement  from Rosyee   
you will find all persons who have birthday today, no matter how  many 
person   there are in the given table. Best regards,  
   Steffen Fra: development-axapta@yahoogroups.com   
[mailto:[EMAIL PROTECTED] På vegne af Ali Ýhsan Aðca   Sendt: 24. oktober 
2007 12:52   Til: development-axapta@yahoogroups.com   Emne: 
[development-axapta] Re: How To Find Persons who born today ?   (birthdate) 
Thanks Rosyee,   But I have to find persons from 
ContactPerson table.   And there more than 200.000 records in there.   
And this method will not be sufficient for finding 5 or maybe max 10   
person from there. Best Regards...   --- In HYPERLINK
mailto:development-axapta%40yahoogroups.com[EMAIL PROTECTED]   com, Rosyee 
rosyee@ wrote:   Hi Ali,   You can use like this   
while Select emplTable{if( 
mthofyr(emplTable.BirthDate) == mthofyr(today()) 
dayofmth(emplTable.BirthDate) == dayofmth(today())){//u'll get 
records who born on same day as today}}   Hope this 
is what you are looking for.   Thanks,Rosyee   
   On 10/24/07, Max Belugin mbelugin@ wrote: I'd prefer 
to extract month and day numbers to separate fields. But you 
can use Connection and native queries On 10/23/07, Ali Ýhsan 
Aðca   aliihsanagca@aliihsanagca%40gmail.com wrote:  
I thought so. But I think there must be a way to include that   case in   
   query filter string   Thanks...   
--- In   HYPERLINK
mailto:development-axapta%40yahoogroups.com[EMAIL PROTECTED]   
comdevelopment-axapta%40yahoogroups.com, Max Belugin  
mbelugin@ wrote: I think, the only way is to 
enumerate dates from today back to   1900.   (AFAIK there is no 
way to store dates prior to 1900) On 10/22/07, Ali 
Ã#65533;hsan Aðca aliihsanagca@ wrote:I want to find the 
persons who were born today?What is the filter for that query? 
  Thanks in advance...  
  Yahoo! Groups Links   
 
   --   Max Belugin, HYPERLINK  
http://belugin.infohttp://belugin.info ,   ICQ:9406811  
   Yahoo! Groups Links 
-- Max 
Belugin, 

RE: [development-axapta] Re: select first only

2007-11-05 Thread James Flavell
Thanks everyone...
 
I tried a join but in my testing it made my method of creating journals of
300 lines 5 seconds slower per journal so i guess in this case a join might
not be the best
But thanks for all your advice it is great to be able to get quality help
and feedback :)
 
Thanks everyone once again :)
 
James
 
  _  

From: development-axapta@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of stuzimmy
Sent: 02 November 2007 12:05
To: development-axapta@yahoogroups.com
Subject: [development-axapta] Re: select first only




James,

A better query might be to join the two tables. Why select WMSPallet
and then query InventPalletBT. You could be looping throught thousands
of records only to find a match in the other table on a small subset. 
Let your DBMS handle that for you.

The only way to guarantee the records are fetched in any particular
order is to order them that way in your where clause. Otherwise you're
at the mercy of the indexes on the table and results can vary.

Hope this helps.

while select WMSPallet
order by WMSPalletId
join InventPalletBT
where inventPalletBT.PalletID ==
WMSPallet.wMSPalletID
{

}

--- In development- mailto:development-axapta%40yahoogroups.com
[EMAIL PROTECTED], James Flavell [EMAIL PROTECTED]
wrote:

 Hi again everyone,

 Another query I have is with the firstonly command. I understand
basically
 how it works but want to know how it really works in practice

 Given this code:

 while select WMSPallet
 order by WMSPalletId
 {
 select firstonly InventPalletBP
 where InventPalletBP.PalletId ==
 WMSPallet.wMSPalletId;

 }


 Is it better to use firstonly in such a situation?

 I mean I am going to be looping through pallets so if I dont use
firstonly a
 number of inventpalletbp table records will be fetched together which
in
 theory would be a good thing to save on database calls. But then i am
 wondering will the records that are fetched be in any particualr order
(e.g.
 by palletid) or just from the same page in the SQL server? I guess it
 should be read ahead according to the where clause or do I need to
 explicitly put an order by or index command against the InventPalletBP
 select statement to be sure of this?

 Looking forward to your input

 Thanks
 James


 [Non-text portions of this message have been removed]


[Non-text portions of this message have been removed]



 


[Non-text portions of this message have been removed]



Re: [development-axapta] CommaIO

2007-11-05 Thread Agus Riyadi
Hi Paulina,

The difference is that tutorial_stdBaseReport run on client (in which you
have access to local folder) while the TaxWithHoldTrans is run on the server
which you do not have access by default.
To get access to the server directory, you must call assert() method of
class that inherits CodeAccessPermission, in your case it is
FileIoPermission class.

You need to change your code like this :

FileIoPermission perm;
;
fileName = your path and file name;
perm = new FileIoPermission(fileName,'w');
perm.assert();
// file operation code here


Regards,

Agus

On 11/4/07, paulinavk [EMAIL PROTECTED] wrote:

   I am having a problem creating a commaio file. I have taken a
 standard Axapta report (TaxWithHoldTrans) and added a write to a text
 file in the execute section. But when I run it I get a permission
 error when I try to create the new commaio instance - before I even
 get to the write. I have tried this modifiying the
 tutorial_stdBaseReport and had no problems at all but when I try it on
 the TaxWithHoldTrans it wont let me create it. Any ideas?
 Regards,
 Paulina

  



[Non-text portions of this message have been removed]



RE: [development-axapta] CommaIO

2007-11-05 Thread Willem Botha
Hi 

 

The file writing classes are protected by CAS. You have to call the
following code before you try an use the class.

 

private void initFileHandle()

{

FileIOPermissionfileIOPermission;

;

fileIOPermission= new FileIOPermission(archiveFileName, 'W');

fileIOPermission.assert();

 

// TwC BP error mitigated using CAS.

// BP Deviation Documented

fileHandle = new CommaTextIo(archiveFileName, 'W');

fileHandle.outFieldDelimiter(',');

fileHandle.outRecordDelimiter('\r\n');

}

 

 

From: paulinavk [mailto:[EMAIL PROTECTED] 
Sent: 05 November 2007 10:31 AM
To: development-axapta@yahoogroups.com
Subject: [development-axapta] CommaIO

 

I am having a problem creating a commaio file. I have taken a 
standard Axapta report (TaxWithHoldTrans) and added a write to a text 
file in the execute section. But when I run it I get a permission 
error when I try to create the new commaio instance - before I even 
get to the write. I have tried this modifiying the 
tutorial_stdBaseReport and had no problems at all but when I try it on 
the TaxWithHoldTrans it wont let me create it. Any ideas? 
Regards,
Paulina

 



[Non-text portions of this message have been removed]