EndsWith() is not supported
cedricfranke28 opened this issue · comments
Cedric Franke commented
Steps to reproduce:
List the minimal actions needed to reproduce the behavior.
var client = new InfluxDL(null);
var influxDBQuery = client.Query();
var query = from s in influxDBQuery
where s.Timestamp > new DateTime(2023, 02, 17, 6, 10, 0, DateTimeKind.Utc)
&& s.Name.EndsWith(".ServiceData.General.OperatingTime")
select s;
System.Diagnostics.Debugger.Break();
var data = query.ToList();
Expected behavior:
The function should filter on the string. in the Linq query for sql this is supported. Contains() doesn't work either. Is there a solution for this?
The following exception occurs:
The expression '[s].Name.EndsWith(".ServiceData.General.OperatingTime")', type: 'System.Linq.Expressions.MethodCallExpression' is not supported.
Specifications:
- Client Version: 4.10.0
- InfluxDB Version: InfluxDB v2.6.1 build_date: 2022-12-29T15:53:06Z
- Platform: Windows 10
Cedric Franke commented
I need a quick fix or another way!
here is an example of how it works in sql with linq:
var allData = (from tagArchive in db.TagsArchives
from tag in db.Tags
where tagArchive.TagId == tag.Id
&& (tag.Name.EndsWith(".ServiceData.General.OperatingTime")
&& tagArchive.ModifiedTimeStamp > @from
&& tagArchive.ModifiedTimeStamp < to
&& tagArchive.TagValue > 0
select new
{
Name = tag.Name,
Value = tagArchive.TagValue,
ModifiedTimeStamp = tagArchive.ModifiedTimeStamp
}).OrderByDescending(x => x.ModifiedTimeStamp).ToList();
var allData = (from tagArchive in db.TagsArchives
from tag in db.Tags
where tagArchive.TagId == tag.Id
&& tag.Name.Contains(".ServiceData.General.NumberOf")
&& tagArchive.ModifiedTimeStamp > @from
&& tagArchive.ModifiedTimeStamp < to
&& tagArchive.TagValue > 0
select new
{
Name = tag.Name,
Value = tagArchive.TagValue,
ModifiedTimeStamp = tagArchive.ModifiedTimeStamp
}).OrderByDescending(x => x.ModifiedTimeStamp).ToList();
Cedric Franke commented
@jeffreyssmith2nd could you help me with my problem? Are you also familiar with linq and influx?