我正在尝试为嵌套数组设置 OPENJSON 函数的路径,但它不起作用。尝试了我在网上找到的不同变体和示例/资源,但仍然无法弄清楚。
有任何想法吗?
编辑:
需要明确的是,我知道如何使用 CROSSAPPLY 和其他方法来做到这一点。我的问题是如何在可能的情况下使用 OPENJSON 函数的路径参数来具体执行此操作。
这是我的代码:
DECLARE @json NVARCHAR(MAX);
SET @json = '
{
"orders": [
{
"id":"1",
"date":"7/4/2020",
"orderlines": [
{"id": "1", "amount": 100},
{"id": "2", "amount": 200}
]
},
{
"id":"2",
"date":"7/4/2020",
"orderlines": [
{"id": "3", "amount": 300},
{"id": "4", "amount": 400}
]
}
]
}
'
-- None of these return results. How do I specify the path to the "orderlines" array?
SELECT * FROM OPENJSON(@json,'$.orderlines');
SELECT * FROM OPENJSON(@json,'$.orderlines[1]');
SELECT * …Run Code Online (Sandbox Code Playgroud) 您如何确定 SortedList 中的最大键是什么?我试过使用 SortList.Max 方法,但我无法让它工作。
这是示例代码:
Dim MySortedList As New SortedList(Of Int16, String)
MySortedList.Add(1, "Item 1")
MySortedList.Add(2, "Item 2")
MySortedList.Add(3, "Item 3")
MySortedList.Add(4, "Item 4")
'I added this just to demonstrates the sorted list is working
Response.Write(MySortedList(4))
'Now... how to I get the max 'Key' from the sorted list?
'In this example I want it to return the number '4'.
Dim MyMaxKey = MySortedList.Max <---- This doesn't work. Added as an example.
Response.Write(MyMaxKey)
Run Code Online (Sandbox Code Playgroud) 尝试将子节点仅从ActiveX TreeView控件拖动到VBA for Excel中的ActiveX ListView控件.它偶尔会起作用,但有些事情是错误的.我无法始终将阻止事件触发(有时它可以工作,有时不工作),或者,当它确实时,确定选择添加到listivew的内容.
我的TreeView具有以下节点
-US (tag='parent')
-West (tag='parent')
-CA (tag='child')
-WA (tag='child')
-East (tag='parent')
-NY (tag='child')
-FL (tag='child')
Run Code Online (Sandbox Code Playgroud)
在上面,我只想让拖动工作在作为'child'的节点上工作.我尝试的代码如下:
Dim MyTreeNode As Node
Dim MyText As String
Private Sub TreeView1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As stdole.OLE_XPOS_PIXELS, ByVal Y As stdole.OLE_YPOS_PIXELS)
Dim MyDataObject As DataObject
Dim Effect As Integer
If Button = 1 Then
'For some reason this executes multple times even though I'm only picking one node.
Debug.Print TreeView1.SelectedItem.Text
If InStr(1, TreeView1.SelectedItem.Tag, "Child") …Run Code Online (Sandbox Code Playgroud)