Contributions
Re: Creating Dictionary in JavaScript
Thanks a lot for your answers. I solved my problem, i will post my code below, maybe will help someone. var wndConspanAnalysisGrid = Aliases.LEAPBridgeConcrete.wndConspan.MDIClient.wndMain.pageMain.pageAnalysis.Custom1; function TestCreateDictionary() { var arrList = getActiveXObject("Scripting.Dictionary"); for (let i = 1; i <= wndConspanAnalysisGrid.wRowCount; i++) { var arrListColumns = getActiveXObject("Scripting.Dictionary"); //Sub keys for (let j = 1; j <= wndConspanAnalysisGrid.wColumnCount; j++) { arrListColumns.Add(GetCellText(0, j), GetCellText(i, j)); } //Principal keys arrList.Add(GetCellText(i, 0), arrListColumns); } /*var safeArray = (arrList.Keys().toArray()) for (let i in safeArray) { Log.Message("Key is: " + safeArray[i]); var lineD = arrList.Item(safeArray[i]); var line = lineD.Keys().toArray(); for (let k in line) Log.Message("Key is: " + line[k] + ", value is: " + lineD.Item(line[k])) }*/ var value = SearchValue(arrList, "2", "Location(m)"); Log.Message(value); //return arrList; } function SearchValue(arrList, lineKey, columnKey) { var line = arrList.Item(lineKey); return line.Item(columnKey); } function GetCellText(i, j) { return wndConspanAnalysisGrid.GetItemText(i, j).m_pszData; }1.9KViews1like0Comments- 1.9KViews0likes2Comments
Re: Creating Dictionary in JavaScript
I am not used with dictionaries in javascript. I ve tried something like this: function testt() { var arrList = getActiveXObject("Scripting.Dictionary"); for (let i = 1; i <= wndConspanAnalysisGrid.wRowCount; i++) { var arrListColumns = getActiveXObject("Scripting.Dictionary"); //Principal keys for (let j = 1; j <= wndConspanAnalysisGrid.wColumnCount; j++) { arrListColumns.Add(GetCellText(0, j), GetCellText(i, j)); } var arrayTest = (new VBArray(arrListColumns.Items())).toArray(); Log.Message("Count " + arrayTest.length); for (let k = 0 ; k < arrayTest.length; k++) Log.Message(arrayTest[i]); arrList.Add(GetCellText(i, 0), arrListColumns); } return arrList; } My new question is how can i print to log.message the whole dictionary to see if its working properly or a function to get the specific element from this dictionary?1.9KViews0likes4CommentsCreating Dictionary in JavaScript
Hello everyone, I need your help with creating a dictionary in JavaScript with multiple keys, like this: array = { "Load Case" : { "(Support)1" : { "Location(ft)" : 0, "Fy(kips)" : 0, "Mz(kft)" : 0, "Deflection(in)": 0, "Rotation(Deg)" : 0 }, "2" : { "Location(ft)" : 0, "Fy(kips)" : 0, "Mz(kft)" : 0, "Deflection(in)": 0, "Rotation(Deg)" : 0 }, }, "Envelope" : { } }; What i m trying to do is to get the values from a grid, and for each line set the name from row[0] as the main key, and as subkeys the name which are on column[0] and after that add values to the subkeys from table[i][j].2KViews0likes6Comments