I am a student and I am new of Mathematica. I am working with relational databases and I am following the guide "Relational Database quick start" find here: https://reference.wolfram.com/language/tutorial/RelationalDatabasesQuickStart.html
I have successfully managed to connect to my database. Now I am using the Entity Framework to query my database.
The problem is that I want to pass a global value inside the EntityFunction and not define the column name a priority. I would like to use the code inside a function and pass dynamic parameters to this function.
So this first example works.
EntityValue[
FilteredEntityClass[
"Customer",
EntityFunction[e, e["City"] != "Vancuver"]
],
{"FirstName"},
"PropertyAssociation"
] // Dataset
But I want to do something like this
function[var_,value_] := (
entity = EntityValue[
FilteredEntityClass[
"Customer",
EntityFunction[e, e[var] != value]
],
{"FirstName"},
"PropertyAssociation"
] // Dataset;
Return[entity];
);
res = function["City", "Vancouver"];
When I try this second solution I get this error
EntityFunction::invexpr: The expression e[var] cannot be compiled to SQL.
Is it not possible to do something like this?
functionthat are interfering with its operation. Try re-evaluating its definition after evaluatingClearAll[function]. – WReach May 28 '20 at 23:52