TR_Field params syntax

what's wrong with my assumed syntax here?

fields = ek.TR_Field('TR.BSPeriodEndDate(IncludePartial=No)', {'Period': 'FI-1'})

as after this, get_data throws an error.

Thank you

---> Please work on the documentation of your otherwise fantastic program.

Best Answer

  • vlscout
    vlscout Explorer
    Answer ✓

    solved it.

    You can enter parameters in 2 different ways.

    either

    fields = ek.TR_Field('TR.BSPeriodEndDate', {'Period': 'FI-1','IncludePartial': 'No'})

    or

    fields = ek.TR_Field('TR.BSPeriodEndDate(Period=FI-1,IncludePartial=No)')

    BUT you cannot match the two...

    QUESTION: Why was the syntax for the function created in such a way? Are there any params that require one way or the other? thank you

Answers

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    https://community.developers.refinitiv.com/discussion/comment/14280#Comment_14280

    Hi @vlscout,

    The string based syntax allows you to copy & paste field names and parameters from Eikon Excel Formula Builder wizard or from Data Item Browser, which are currently the primary means for metadata discovery. Dictionary based syntax is arguably more native to Python. It's also arguably easier to read than flat string based syntax, especially for those who are used to ever so popular JSON.
    Eventually we probably would like to standardize on one type of syntax. Which one do you prefer and why?

  • vlscout
    vlscout Explorer
    https://community.developers.refinitiv.com/discussion/comment/14337#Comment_14337

    Thank you Alex! At this point, as a python newbie, I prefer the "everything in one string" syntax.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.