0

Hi is there a way to select a value filtered with multiple parameter with flux language in influx db : Exemple in sql : select val1 from tab1,tab2,tab3 where val2.tab2>30 and val3.tab>6 . Is this possible in flux language ? Thanks

For now I only grab every value that I need and I filtered myself on Java but the problem is that java take too many time to filtering values.

HashMap<String,Float> drivepumpchargepresshash = inConn.queryData(clientRead,drivepumpchargepress,camu3,vibrateur01,prev,now,null);
        HashMap<String,Float> hydOilTempHash = inConn.queryData(clientRead, hydOilTemp, hydOilTempGroup, vibrateur01, prev, now,null);
        HashMap<String,Float> engSpeedHash = inConn.queryData(clientRead, engSpeed, ecc1, vibrateur01, prev, now,null);
        HashMap<String,Float> wheelBasedVehicleSpeedHash = inConn.queryData(clientRead, wheelBasedVehicleSpeed, ccvs1, vibrateur01, prev, now,null);
        //Query data
        
        ArrayList<Float> filteredList = new ArrayList<Float>(); 
        HashMap<String,HashMap<String,Float>> outerMap = new HashMap<String, HashMap<String,Float>>(); // storing as : key : date , value : [key:para_name , value: para_value]
        float max,min,maxmin,mean,standard_deviation; //initalise calculation variable
        for(String date : drivepumpchargepresshash.keySet()) {//If contain a value at this date
            if(engSpeedHash.containsKey(date) && wheelBasedVehicleSpeedHash.containsKey(date) && hydOilTempHash.containsKey(date)) {
                HashMap<String, Float> innerMap = new HashMap<String,Float>();
                innerMap.put(drivepumpchargepress, drivepumpchargepresshash.get(date));
                innerMap.put(engSpeed, engSpeedHash.get(date));
                innerMap.put(wheelBasedVehicleSpeed, wheelBasedVehicleSpeedHash.get(date)); //Stocking all data
                innerMap.put(hydOilTemp, hydOilTempHash.get(date));
                outerMap.put(date, innerMap);
            }
        }
LucasG
  • 11
  • 3

2 Answers2

0

I never used InfluxDB but I found this searching on th Internet: [https://docs.influxdata.com/influxdb/cloud/query-data/flux/join/]

I think you will find your answer there.

You will need to use join() on tab1, tab2 and tab3. You must use filter(fn:...) to filter data on specified values (30 and 6 in your example).

Hope it helps

0

if you used influxdb2,FLuxApi about filter keyword will help you .else, you can import maven pom like:

        <groupId>org.influxdb</groupId>
        <artifactId>influxdb-java</artifactId>
        <version>version</version>  
         ..


 Query query = new Query(s, this.influxConfig.getDatabase());
  QueryResult queryResult = this.influxDB.query(query);
  List<QueryResult.Result> results = queryResult.getResults();