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
    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

  • 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?

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