选择列" BY"使用Google查询语言

时间:2015-11-10 12:16:00

标签: google-sheets gql

我正在尝试选择列" BY" (来自BX列之后和列BZ之前的那个)来自Google电子表格中的查询,但似乎列名称或标识符被识别为查询语言的特殊单词(作为顺序" by"),所以我无法让查询正常工作。

我尝试在查询中使用单引号(' BY')和其他变体,但都没有效果。

我有什么办法可以在列#34; BY"上选择值。在QUERY实例中?

公式不工作的示例:

private static PopupWindow pw;
private View layout;
private static ViewGroup vg = (ViewGroup) findViewById(R.id.popup_container);

private void initiate_popup(){
    layout = inflater.inflate(R.layout.popup,
            vg);
    pw = new PopupWindow(layout, 500,
            450, true);
    pw.setOutsideTouchable(true);
    pw.setBackgroundDrawable(new ColorDrawable(
            android.graphics.Color.TRANSPARENT));
    pw.setTouchInterceptor(on_outside_touch);
    pw.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss() {
            hideKeyboard();
        }
    });

    // display the popup in the center
    pw.showAtLocation(layout, Gravity.CENTER, 0, 0);

    String name = "some txt";

    // Declaring EditText
    InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    final EditText text_name = (EditText) layout.findViewById(R.id.text_name);
    imm.hideSoftInputFromWindow(text_name.getWindowToken(), 0);
    text_name.setText(name);
}

// hide Keyboard method
public void hideKeyboard() {
    InputMethodManager imm = (InputMethodManager) ctx
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); // hide
    } else {
        ctx.getWindow()
                .setSoftInputMode(
                        WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    }
}

错误讯息:

=if($B18=0, "select an item", QUERY($A14:$DO16, "SELECT A WHERE BY="&MAX(BY14:BY16)))

使用其他列时相同公式的示例正常工作:

Error
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROREncountered "BY" at line 1, column 16. Was expecting one of: "true" ... "false" ... "not" ... "date" ... "timeofday" ... "datetime" ... "timestamp" ... "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ... <ID> ... <INTEGER_LITERAL> ... <DECIMAL_LITERAL> ..

1 个答案:

答案 0 :(得分:0)

在BY关键字周围解析此地方反引号(1键左侧的键)。