Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EndsWith() is not supported #468

Open
cedricfranke28 opened this issue Feb 17, 2023 · 2 comments
Open

EndsWith() is not supported #468

cedricfranke28 opened this issue Feb 17, 2023 · 2 comments

Comments

@cedricfranke28
Copy link

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
@cedricfranke28
Copy link
Author

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();

@cedricfranke28
Copy link
Author

@jeffreyssmith2nd could you help me with my problem? Are you also familiar with linq and influx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant