resources/assets/js/editor.js
//Generate google queries for each query in3.0ut from report data and query template
Generate google queries for each query in3.0ut from report data and query template
Generate google queries for each query in3 . 0ut from report data and query template
function generateQueries(checkIframe,$reportIframe){
        var $inputs=checkIframe.contents().find(".generated-query-input");
        $.each($inputs, function () {
           var $params = $(this).data('params');
            var idsArr= $(this).data('ids').split(',');
            $.each(idsArr,function(index,value){
                var indexValue=index;
                var elementValue=$reportIframe.contents().find('#'+value).val();
                if(elementValue!=""){
                    var regex = '(")(p' + indexValue + ')[\\s]|(p'+indexValue+')(")|(")(p'+indexValue+')(")';
                    $params = $params.replaceAll(regex,elementValue+" ");
                }
            });
            $params = '"'+$params.trim()+'"';
            if($params.match(/(")p[0-9]+|p[0-9]+(")|(")p[0-9]+(")/)){
              $(this).closest('.form-group').remove();
            }
            $(this).val($params);
        });
    }
function generateQueries ( checkIframe , $reportIframe ) { var $inputs = checkIframe . contents ( ) . find ( ".generated-query-input" ) ; $ . each ( $inputs , function ( ) { var $params = $ ( this ) . data ( 'params' ) ; var idsArr = $ ( this ) . data ( 'ids' ) . split ( ',' ) ; $ . each ( idsArr , function ( index , value ) { var indexValue = index ; var elementValue = $reportIframe . contents ( ) . find ( '#' + value ) . val ( ) ; if ( elementValue != "" ) { var regex = '(")(p' + indexValue + ')[\\s]|(p' + indexValue + ')(")|(")(p' + indexValue + ')(")' ; $params = $params . replaceAll ( regex , elementValue + " " ) ; } } ) ; $params = '"' + $params . trim ( ) + '"' ; if ( $params . match ( / (")p[0-9]+|p[0-9]+(")|(")p[0-9]+(") / ) ) { $ ( this ) . closest ( '.form-group' ) . remove ( ) ; } $ ( this ) . val ( $params ) ; } ) ; }
Generate google queries for each query in3.0ut from report data and query template
Generate google queries for each query in3 . 0ut from report data and query template
//Id's of input elements from report //This represents the value that will be replaced in the query template //Replace all parameter occurences(p1,p2,p3 see queries structure in q) by the element value //Check if the query still has not rplaced parameters ,means ,matching input from report was not present