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

"or" operator for condition #2

Closed
sveip opened this issue May 13, 2016 · 4 comments
Closed

"or" operator for condition #2

sveip opened this issue May 13, 2016 · 4 comments

Comments

@sveip
Copy link

sveip commented May 13, 2016

Trying to query select one,two,three from stats where myCond='40002' or myCond='40007' and time <= 1463142720s and time >= 1463142660s

Tried with

const reader = client.query('stats');
reader.addField('one', 'two', 'three');
reader.start = start;
reader.condition("myCond='40002' or myCond='40007'");

In this case the condition is ignored. If I only enter one condition without "or" operator it is considered and included in the query.

How can I add several conditions on the same field as one would do with "or" operator?

@vicanso
Copy link
Owner

vicanso commented May 13, 2016

In the previous version, you can use as follows:

const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.addCondition("myCond='40002' or myCond='40007'");
console.info(ql.toSelect());

Now I have updated a new version to enhance the condition function

const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.condition("myCond='40002' or myCond='40007'");
console.info(ql.toSelect());

@sveip
Copy link
Author

sveip commented May 13, 2016

Thanks! Would it be an idea to support conditions as key-value pairs where they value can be an array in a case like i have above?

-----Original Message-----
From: "Tree Xie" notifications@github.com
Sent: ‎13/‎05/‎2016 17:22
To: "vicanso/influx-ql" influx-ql@noreply.github.com
Cc: "sveip" petersveistrup@gmail.com; "Author" author@noreply.github.com
Subject: Re: [vicanso/influx-ql] "or" operator for condition (#2)

In the previous version, you can use as follows:
const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.addCondition("myCond='40002' or myCond='40007'");
console.info(ql.toSelect());Now I have updated a new version to enhance condition function
const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.condition("myCond='40002' or myCond='40007'");
console.info(ql.toSelect());—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@vicanso
Copy link
Owner

vicanso commented May 14, 2016

Now I have updated a new version, , you can use as follows:

const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.condition('myCond', ['40002', '40007']);
console.info(ql.toSelect());

@sveip
Copy link
Author

sveip commented May 14, 2016

Great, thanks! :-) Will try it out.

-----Original Message-----
From: "Tree Xie" notifications@github.com
Sent: ‎14/‎05/‎2016 15:57
To: "vicanso/influx-ql" influx-ql@noreply.github.com
Cc: "sveip" petersveistrup@gmail.com; "Author" author@noreply.github.com
Subject: Re: [vicanso/influx-ql] "or" operator for condition (#2)

Now I have updated a new version, , you can use as follows:
const QL = require("influx-ql");
const ql = new QL();
ql.measurement = 'stats';
ql.addField('one', 'two', 'three');
ql.start = '1463142660s';
ql.end = '1463142720s';
ql.condition('myCond', ['40002', '40007']);
console.info(ql.toSelect());—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@sveip sveip closed this as completed Aug 10, 2016
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

2 participants