Hi all, I'm working from R with an M9 project (link via ODBC driver), and am trying to execute a query that calls a C# script, but the query fails. However, the query runs without problem in M9. My R is in french, but the error message sounds like "Impossible to load the file or the assembly 'extnet' or one of its dependencies. File not found". I'm wondering if there is a technical reason such an error happens (maybe linked to the ODBC driver) or if I'm doing something wrong. In more details, here is what I do In the M9 project the query (called [Query]) that calls the C# script looks like this -- $manifold$ FUNCTION FillRowNum(@t TABLE) TABLE AS SCRIPT [S ADD RANK] ENTRY 'Script.FillRowNum' ENTRYSCHEMA 'Script.FillRowNumSchema'; DROP TABLE test; SELECT * INTO test FROM ( TABLE CALL FillRowNum( ( SELECT 0 AS rownum, name, first(property), first(value) FROM mfd_meta GROUP BY name ORDER BY name ) ) ); The C# script in [S ADD RANK] is a script that was shared by one of the users of the forum. It adds a rank to a table. Here is its content // C# using M = Manifold; class Script { // get names of all schema fields static string[] GetSchemaFields(M.Schema schema) { M.ValueSet values = Manifold.Application.CreateValueSet(); foreach (M.Schema.Field field in schema.Fields) values.AddValue(field.Name); return values.GetValueNames(); } // create a copy of source table and fill first field with row numbers public static M.Table FillRowNum(M.Table src) { // create empty copy of source table M.Table tgt = FillRowNumSchema(src); // copy all records from source table M.Sequence sequence = src.SearchAll(GetSchemaFields(src.GetSchema())); if (sequence == null) return tgt; // no records long counter = 0; // int64 while (sequence.Fetch()) { M.ValueSet values = sequence.GetValues(); values[0].Data = counter++; tgt.Insert(values); } return tgt; } // tell the query engine the result of FillRowNum will be a table // with same schema as source table public static M.Table FillRowNumSchema(M.Table src) { // use all fields, ignore indexes and constraints M.Schema schema = Manifold.Application.CreateSchema(); foreach (M.Schema.Field field in src.GetSchema().Fields) schema.AddField(field.Name, field.Type); // ignore expressions // create empty table with composed schema M.Table tgt = Manifold.Application.CreateTable(); tgt.Design(schema); return tgt; } static M.Context Manifold; static void Main() { } } And the R script contains library(odbc) library(DBI) dstring1 <- "DRIVER={Manifold 9.0 Project Driver (*.map)};DBQ=D:\\manifold\\test_scriptr.map;Unicode=True;Ansi=False;OpenGIS=True;DSN=Default;" con_m9 <- dbConnect(odbc::odbc(), .connection_string = dstring1 ) dbSendQuery(con_m9, "EXECUTE [Query]") Many thanks in advance for your inputs
|