Labels

Export a table visualization to a file


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from System.IO import Path, File, StreamWriter
from Spotfire.Dxp.Application.Visuals import TablePlot
 
#Temp file for storing the table data
tempFolder = Path.GetTempPath()
tempFilename = Path.GetTempFileName()

#Export table data to the temp file
writer = StreamWriter(tempFilename)
vTable.As[TablePlot]().ExportText(writer)

print tempFilename

Input
vTable (Visualization)

Not suitable for use over the web since the local file system is used.

25 comments:

  1. Hi, Thanks for sharing the code I am not an expert in Iron Python. I am trying to learn Iron Python. I tried to execute the code for export the cross table to excel and got the error for "System.MissingMemberException: 'DataTable' object has no attribute 'As'" Could you please help me the solution of the mentioned error. One more thing, I have many cross tables on different pages as well as on same page, if I want to export the specific cross table to excel with grand total and sub total. Can I export it? if yes please share me the guide. Thanks in advance
    Regards,
    Hinu

    ReplyDelete
    Replies
    1. Hi,
      Can you help providing a code to export all table plots in a page to excel as different sheets

      Delete
  2. Hi Hinu, This particular snippet only works with Tables, not Cross Tables. I've just posted a new snippet that works with Cross Tables. (link below) Please give that one a try. The sub-totals will also be exported along with the Cross Table data. This script can work with tables from different pages, just change the input when defining the script.

    http://easyspotfire.blogspot.com/2014/11/export-cross-table-visualization-to-file.html

    ReplyDelete
  3. Hi Dave - I was wondering if this could be modified to export details on demand?

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hi Dave,
    Could you please help me to export data from a table to excel in webplayer.
    I have ironpython script that works for client and not webplayer.
    Thanks!

    ReplyDelete
  7. I like this post because it is informative and helpful to all readers. I would like to revisit this post. Welcome to the njpropertyrecords! Njland records information you about NJ Tax Maps and map searches.

    ReplyDelete
  8. I've got the above code working, but now Im trying to set filters before exporting... however if a page doesnt have any filters it bugs out... how would I check if a page has any filters??? some sample code below...

    for p in Document.Pages:
    if p.Filters.Count > 0:
    for y in p.Filters:
    if (y.TypeID == FilterTypeIdentifiers.ListBox):
    y.IncludeAllValues = True
    for v in p.Visuals:
    #code to export WORKING

    ReplyDelete
  9. Hi,
    Can you help providing a code to export all table plots in a page to excel as different sheets
    thanks,
    -Dileep

    ReplyDelete
  10. I get the following NameError with this script:
    File "Spotfire.Dxp.Application.ScriptSupport", line unknown, in ExecuteForDebugging
    File "", line 9, in
    NameError: name 'writer' is not defined

    Microsoft.Scripting.Runtime.UnboundNameException: name 'writer' is not defined
    at IronPython.Runtime.PythonContext.MissingName(SymbolId name)
    at Microsoft.Scripting.Runtime.LanguageContext.LookupName(CodeContext context, SymbolId name)
    at Microsoft.Scripting.Runtime.RuntimeHelpers.LookupName(CodeContext context, SymbolId name)
    at $884##884(Closure , Scope , LanguageContext )
    at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
    at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)

    ReplyDelete
  11. I really appreciate the information shared above. It’s of great help. If someone wants to learn Online (Virtual) instructor lead live training in TIBCO Spotfire TECHNOLOGY, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor-led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ pieces of training in India, USA, UK, Australia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Pratik Shekhar
    MaxMunus
    E-mail: pratik@maxmunus.com
    Ph:(0) +91 9066268701
    http://www.maxmunus.com/

    ReplyDelete
  12. Hello Buddie,


    10/10 !!! Thank you for making your blogs an embodiment of perfection and simplicity. You make everything so easy to follow.

    I am trying to connect to LinkedIn API via BW Container edition and need to pass Access token to get the response. However i do not see any configuration related to OAuth in REST Refrence or Invoke REST API palltete.






    Follow my new blog if you interested in just tag along me in any social media platforms!



    Obrigado,
    Irene Hynes

    ReplyDelete
  13. Merhaba,


    10/10 !!! Thank you for making your blogs an embodiment of perfection and simplicity. You make everything so easy to follow.

    A customer is requiring me to document all calculated columns expressions in TIBCO Spotfire in excel for the document of a special study. Is there a way to download all formula expressions in such manner? Alternatively a PDF or other similar file format will do.






    But nice Article Mate! Great Information! Keep up the good work!


    Kind Regards,
    Ajeeth

    ReplyDelete
  14. Hello There,

    Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long.

    I've been building a custom Automation Services extension the past couple days and launching it via the Package Builder. Yesterday, as I tried to add a `ViewAddIn` Windows Form project to the package, Spotfire Analyst began to crash on `Loading extensions...`. I'll add the details of that crash below.
    Package Builder had originally worked up to that point worked up to that point. Since I originally tested Package Builder using the provided `SpotfireDeveloper.AutomationServicesExample` and `AutomationServicesExample.Forms` projects in the SDK, I cleared my configuration of my own project and tried to launch with the example again. Spotfire Analyst now crashed at the same point.
    Then I tried to launch vanilla Spotfire Analyst (without Package Builder), and again it crashed at `Loading extensions...`.
    I've been banging my head against this for the past two days. No matter what I do, I cannot get Spotfire Analyst to launch.
    Excellent tutorials - very easy to understand with all the details. I hope you will continueto provide more such tutorials.

    Grazie,
    Preethi

    ReplyDelete



  15. Outstanding TV coverage at a very low price. I have been without cable for 2 yrs now. After discovering NFLHQNETWORK.comNFLHQNETWORK.com rocks !!!!

    ReplyDelete
  16. NFLHDSPORTS.COM
    NFLHDSPORTS.COM
    Falcons vs Seahawks, Steelers vs Chiefs, Cowboys vs Packers Texans vs Patriots,

    ReplyDelete
  17. importers data Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors.

    ReplyDelete
  18. bet77 salah satu bandar Slot Gacor 777 terpercaya di Indonesia 2023 dengan judi bet77 online gacor winrate kemenangan tinggi Daftar di link login bet77.

    ReplyDelete
  19. Slot BCA adalah sebuah web taruhan online slot deposit Bank BCA yang menggunakan proses deposit Bank BCA dan terdaftar sah di badan judi Internasional. Web judi deposit Bank BCA saat ini menjadi

    ReplyDelete
  20. Dewagacor89 ialah sebuah agen judi online slot garansi kekalahan 100 bebas ip terbaru yang sudah terpercaya memiliki permainan slot online gacor mudah menang saat ini.
    keyword terkait:
    Slot garansi kekalahan 100
    Garansi kekalahan 100
    Slot garansi kekalahan 100 saldo kembali
    Slot garansi kekalahan 100 tanpa TO

    ReplyDelete
  21. Selamat datang di Slot 4d atau lebih kita kenal dengan slot gacor 4d merupakan salah satu link login slot 4d terbaik dan terpercaya gampang menang maxwin hari ini.">slot deposit dana yang menciptakan promo paling populer di tahun 2023 serta dicari-cari oleh berbagai pelanggan permainan situs slot gacor.

    ReplyDelete