@type {JSFoundSet

Hi all,

I need to set the tablename ```
/** @type {JSFoundSetdb:/someDatabase/tablename} */

dynamically to do so I create a variable and place the variable between the {}, something like this,

//$name is passed as param
var $fsType = ‘JSFoundSetdb:/someDatabase/‘+$name+’’;

/** @type {$fsType} */
var $fs = databaseManager.getFoundSet(‘db:/someDatabase/’+$name);


Is this above code valid to dynamically set the **@type** ?

Regards,

Peter

Hi Peter,

You can’t use variables in JSDoc (other than defining them).
What is your use-case for this dynamic type?

Hi Robert,

I’m exporting data from different tables from our application server to a runtime solution.
The exported record(s) is/are exported per table to a location on the users pc e.g. “c:\export\customer.json”,
now to keep the import method generic I want to use the file name, “customer”, to compose the JSFoundset type.

Regards,

Peter

You can’t be generic, but then try to be specific. You either type your foundset as just that, any foundset (@type {JSFoundSet}) or you need separate methods for each table where you type the specific foundset.

Hi Peter,

Like what Patricks says, use the generic JSFoundSet type so your functions (newRecord, etc) will not throw any markers.
You will probably be addressing any columns by $fs[‘columnName’] or $fs[someArray*] anyway so that won’t throw any markers either.*

ROCLASI:
Hi Peter,
You will probably be addressing any columns by $fs[‘columnName’] or $fs[someArray*] anyway so that won’t throw any markers either.[/quote]*
Exactly, I’ve “full control”,
* *{ "CUSTOMER": [{ "RECORD": [{ "coltype": "INTEGER", "colname": "customer_id", "value": "196" },* *
So
* _/** @type {JSFoundSet} */_ *
will do.
Regards,
Peter