一般查询亲子关系

时间:2018-09-27 18:08:52

标签: acumatica

我一直在尝试从通用查询中的Contract,ContractDetail,ContractItem和InventoryItem中提取数据。因此,在将所有4个表加起来之后,我创建了如下关系。

enter image description here

Contract和ContractDetail之间的关系很好。现在,由于ContractDetail使用ContractItemID,因此我将关系设置如下。但这会引发我这样的错误。

enter image description here

然后,在查看堆栈跟踪时,我发现生成的查询看起来像这样:

import { createStore, combineReducers } from "redux";
import { reducer as formReducer } from "redux-form";
import { INIT_FORM, SET_FORMFIELDS, SERVER_ERROR } from "../types";

const fieldsReducer = (state = {}, { payload, type }) => {
  switch (type) {
    case SET_FORMFIELDS:
      return { ...state, ...payload };
    default:
      return state;
  }
};

const serverResponseReducer = (state = "", { payload, type }) => {
  switch (type) {
    case SERVER_ERROR:
      return (state = payload);
    default:
      return state;
  }
};

const formReducers = {
  form: formReducer.plugin({
    SimpleForm: (state, { payload, type }) => { // <----- 'SimpleForm' - name given to reduxForm()
      switch (type) {
        case INIT_FORM: // <----- action type triggered by componentDidUpdate from 'SimpleForm'
          return {
            ...state, // <----- spreads out any previous form state (registered fields)
            values: {
              ...payload // <----- initializes form fields values from supplied initForm action 'field' values
            }
          };
        default:
          return state;
      }
    }
  })
};

export default combineReducers({
  fields: fieldsReducer,
  server: serverResponseReducer,
  ...formReducers
});

因此,查询中表的别名存在问题。那么,如何解决此问题?

谢谢。

1 个答案:

答案 0 :(得分:0)

Acumatica中的联接与SQL中的联接完全相同。首先,使用SQL构建查询并获取所需的结果,然后尝试在通用查询中构建相同的查询。

除此之外,我没有看到合同与库存之间的任何关系。请解释一下您想要得到什么。

这是您应该在通用查询中联接表的方式

enter image description here