Hi Manfred,
Thanks for your reply. Do you know how to add a formdatasource at
runtime? I can't find any ways to do it myself. However, I still think
it must be a formbuilddatasource because e.g. formbuildcontrol's can be
added at runtime - but not a formbuilddatasource. I suspect it's a bug
in Axapta.
Best regards,
Lars Holm
Senior Technical Consultant
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of smeagul2303
Sent: 15. april 2005 09:15
To: [email protected]
Subject: [development-axapta] Re: Formbuilddatasource - adding a
datasource runtime to an already running form
Hi Lars,
I think the problem is the FormBuildDatasource. A FormBuildDatasource is
used in Designer, in Morphx, before the form is build.
At runtime you have to use a FormDatasource.
Try it, perhaps it helps
Manfred
--- In [email protected], "Lars Holm" <[EMAIL PROTECTED]>
wrote:
>
> Hi guys,
>
>
> Is it possible to add a datasource to a form at runtime?
>
> The following code
>
> fbds = this.form().addDataSource(tableid2name(tableId));
> fbds.name(tableid2name(tableId));
> fbds.table(tableId);
> fbds.autoQuery(true);
> fbds.autoSearch(true);
> fbds.linkType(3);
> fbds.joinSource('custtable');
> fbds.allowCreate(true);
> fbds.allowDelete(true);
> fbds.allowEdit(true);
>
> executes etc. but
>
> element.dataSourceCount()
>
> returns only 1 which is the original amount of datasources and not 2
> which I would have expected. Besides, the datasource has no effect
> thus is not being used.
>
> The adding of the datasource is called after super in the form. If I
> call it before super, Axapta crashes when the datasource is added.
>
> Does anyone know why? It's necessary that I add the form datasource
> and not a table to a query because a field from the datasource must be
> used in the form.
>
> Thanks in advance.
>
>
> Best regards,
> Lars
>
>
>
> [Non-text portions of this message have been removed]
Yahoo! Groups Links
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

