在这种情况下,我正在使用应用程序通过查询findAsset过滤数据。
我必须发送一个过滤器数组,findAsset将使用该过滤器响应所过滤的数据,但是,正在发送的数组不是根据graphQl查询得出的。
我附上了当前和正确的情况。
这是数组
_______________________________
Sub FolderPicker()
'
' first attempt at a folderpicker.
' Brings up file dialog box and user selects location path. Location path
is ' ' store in cell ("M11") on worksheet. This macro is stored on
'Sheets("Import_Macro").Select
'
'
Dim diaFolder As FileDialog
'
Set diaFolder = Application.FileDialog(msoFileDialogFolderPicker)
diaFolder.AllowMultiSelect = False
diaFolder.Show
fle = diaFolder.SelectedItems(1)
Range("M11") = fle
Set diaFolder = Nothing
End Sub
_______________________________
Sub import_parameter()
'
' import_parameter Macro
' This was created with a recorded macro in excel.
' Opens a hardcode path and filename txt file and goes through the txt
' delimited wizard
' then copies select data into the current open workbook.
' This macro is stored on Sheets("App Settings").Select
'
Application.ScreenUpdating = False
Workbooks.OpenText Filename:="C:\txtdata\cf_parameter.txt", Origin:=437,
_
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1),
_
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)),
TrailingMinusNumbers:=True
Range("A2:G2000").Select
Selection.Copy
Windows("TRH Pre-Installation Guide.xlsm").Activate
Sheets("App Settings").Select
Range("B6:H6").Select
ActiveSheet.Paste
Selection.AutoFilter
Application.CutCopyMode = False
ActiveWindow.ActivateNext
ActiveWindow.Close
Range("B4").Select
Application.ScreenUpdating = True
End Sub
_________________________________
当前:
constructor(private filterService: FilterService, private route: ActivatedRoute, private fb: FormBuilder, private houseService: HousesServices) {
this.testForm = this.fb.group ({
budget : this.fb.group({
gte: '',
lte: ''
}),
area : this.fb.group({
gte: '',
lte: ''
})
});
this.testForm.valueChanges.subscribe( e => {
this.filterCriteriaChanged.emit(this.filtersParam(e));
console.log(e);
});
}
private filtersParam (args): any {
const FILTER_MAP = {
area: 'basic.parcelFiscalArea',
budget: 'pricing.price'
}
console.log();
let resultO = [];
let params = args;
for (let key in params ) {
const currentFilter = FILTER_MAP[key];
for (let key2 in params[key]) {
// console.log(params[key][key2]);
if (params[key][key2]) {
let res: any = {};
res.name = currentFilter;
res.op = `${key2}`;
res.value = params[key][key2];
resultO.push(res);
}
}
}
console.log(resultO);
return JSON.stringify(resultO);
}
正确的查询
{
findAssets(
bounds: [
[2.383443042596838, 48.88251557008428]
[2.310486957387212, 48.83525071179383]
]
filter: [
{ "name": "basic.parcelFiscalArea", "op": "gte", "value": 100 }
{ "name": "basic.parcelFiscalArea", "op": "lte", "value": 1000 }
]
) {
list {
address {
number
street
zipCode
}
memberOf {
city
}
info {
name
value
}
media {
type
caption
path
}
}
}
}
如何正确发送阵列?
我遇到了JSONtoGraphQlQuery,但无法获得所需的输出。