Title: Message
Hi all!
Thanks for all replys!
I have now tried different solutions in order to select and display my data.
 
The problem is that the table contains a lot of data which makes the queries run very slow.
 
I have tried to use a select directly in the executeQuery-method, and that works, but it runs too slow.
 
select relations
where relations.HNDMedRelAccount == smmBusRelTable.HNDMEDConnectedCustomerId ||
relations.HNDMEDConnectedCustomerId == smmBusRelTable.HNDMedRelAccount;
 
The same goes for the solution described by Michael Niemeyer below.

If I run the select in a job or ar static method it takes no time, but running it in the executeQuery causes Axapta to hang. If I change the OR (||) operator to an AND (&&) operator, then the select runs fast. (If I wait long enough, it will finally display the data that I want.)

I've tried to put the select-statement in a static-method and return the selected records, then use the data-method of the datasource-table. But that doesn't seem to work.

Does anyone know if it is possible to set the data of a datasource, using e.g a static method on a table and have that method return the data that is to be displayed?

Regards Bjørn

-----Original Message-----
From: Michael Niemeyer [mailto:[EMAIL PROTECTED]
Sent: 19. april 2004 09:14
To: [EMAIL PROTECTED]
Subject: RE: [development-axapta] Query logic OR

Hi!

An example from CustTable:
((Name == "Velofix AG") || (InvoiceAccount == "4008")).
You can use each field in the Query for e.g. Recid.


In the code you can do this:

public void init()
{
    Range range;
    QueryBuildRange qbr;
    custaccount account = '4008';
    name        name    =  'Velofix AG';
    ;
    super();


    qbr =
this.query().datasourcetable(tablenum(custTable)).addrange(fieldnum(custtable,
recid));

    range   = strfmt('((%1 == \"%2\") || (%3 ==
\"%4\"))',fieldstr(CustTable,Name),name,fieldstr(CustTable,InvoiceAccount),account);

    qbr.value(range);


}



Regards Michael


>From: Bjørn Gudbrand Idstad <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: [development-axapta] Query logic OR
>Date: Fri, 16 Apr 2004 15:25:03 +0200
>
>Hi!
>
>Is it possible to create a Query in Axapta, that fetches all records from a
>table, where the value in field one is "xxx" or the value of field two is
>"yyy".
>
>E.g I want to get all records from SmmBusRelTable where field "Firma"
>matches "2142917" OR where "ABC-kode" matches "A".
>
>
>
>
>
>Regards Bjørn

_________________________________________________________________
MSN Messenger - sehen, welche Freunde online sind!
http://www.msn.de/messenger Jetzt kostenlos downloaden und mitmachen!



Yahoo! Groups Links

Reply via email to