matteoluigi Posted November 1, 2024 Share Posted November 1, 2024 (edited) I wrote these few lines of script and now i am wondering (not much but a bit) why the database-rows don't work the way I wanted in the created worksheet: First it turns out the following layout: That's a little bit "strange" because all WS-database rows are limited to one wallstyle. Only when I refresh every single database-criteria there's only one wall per database row. Maybe I should switch and concatenate all wallstyles into one criteria line 😉 but, that's the way I did it now. What do you think? for object_name in object_names: object_handle = vs.GetObject(object_name) #listentitelzeile = (vs.Concat('=DATENBANK(INCLSUBX & ((T=WAND) & (SPT=', apo, 'Schicht', apo, ') & (','WST=',apo,object_name,apo,')))')) listentitelzeile = (vs.Concat('=DATENBANK(T=WAND) & (','WST=',apo,object_name,apo,')')) #=DATENBANK(INCLSUBX & ((T=WAND) & (SPT='Schicht') & ("WST='WA-A-TRA-ST-200-MWV-115-MVW-115-476"'))) vs.SetWSCellFormulaN(WSHandle,row,0,row,0,listentitelzeile) #vs.SetWSCellFormulaN(WSHandle,2,0,2,0,"=DATENBANK((T=WAND))") vs.SetWSCellFormulaN(WSHandle,row,1,row,1,"=Grafik") vs.SetWSImgSize(WSHandle,row,1,row,1,50,50) vs.SetWSImgSizeType(WSHandle,row,1,row,1,1) vs.SetWSCellFormulaN(WSHandle,row,2,row,2,"=WANDSTIL") (boole,object_compNr) = object_componentnr = vs.GetNumberOfComponents(object_handle) for comp_nr in range (1,object_compNr+1): vs.SetWSCellFormulaN(WSHandle,row,comp_nr+2,row,comp_nr+2,(vs.Concat('=OBJEKTDATEN(',apo,'Schicht',apo,';',apo,'Name',apo,';',apo,comp_nr,apo,')'))) row = row+1 create ws script.zip Edited November 1, 2024 by matteoluigi Quote Link to comment
Pat Stanford Posted November 1, 2024 Share Posted November 1, 2024 You might need to post this to the German forums instead. There are many lines that will not operate properly in the English version. I tried to do the conversion (DATENBANK -> DATABASE, T=WAND -> T=WALL, OBJEKTDATEN -> OBJECTDATA), but there were still others that I was unable to find in the time I had available. Sorry. In the original file you posted, the worksheet shows the problem where is reporting all three wall styles even though the criteria is only for one. I have not idea why that is happening and since I can't get the script to run, I can't try and figure out why. Quote Link to comment
Pat Stanford Posted November 1, 2024 Share Posted November 1, 2024 OK, I figured it out. listentitelzeile = (vs.Concat('=DATENBANK(T=WAND) & (','WST=',apo,object_name,apo,')')) Notice the parentheses around the criteria. The way it is written VW is assuming that the criteria is only (T=WAND) [Wall]. Once you open the criteria editor it is seeing both parts and updating appropriately. If you add another set of parenthenses it will work properly. listentitelzeile = (vs.Concat('=DATENBANK((T=WAND) & (','WST=',apo,object_name,apo,'))')) Quote Link to comment
matteoluigi Posted November 3, 2024 Author Share Posted November 3, 2024 seems to work now, and seems, that the criteria-editor repaired the criteria, everytime I did open it. thank you 🙂 btw, does there exist a command to set a database row to sort or sum up all sublines in the same column? Quote Link to comment
matteoluigi Posted November 3, 2024 Author Share Posted November 3, 2024 … looks like vs.SetSprdSortSumColumns does it… 😄 Quote Link to comment
matteoluigi Posted November 3, 2024 Author Share Posted November 3, 2024 … and vs.SetSprdSortSum and vs.SetWSColumnSortType … looking for a command to show or hide database rows in a worksheet? Quote Link to comment
Jesse Cogswell Posted November 3, 2024 Share Posted November 3, 2024 (edited) It's a Object Variable setting, selector 82. So run a vs.SetObjectVariableBoolean(<handle to worksheet>,82,FALSE) to hide it. Edited November 3, 2024 by Jesse Cogswell 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.