Skip to main content
Solved

How to add a CUSTOM field to the ODATA stream

  • March 12, 2025
  • 10 replies
  • 244 views

Forum|alt.badge.img+2

Looking to add a CUSTOM long text data field to the ODATA feed that I can use on my Power BI portfolio dashboard.  I’d like to add it to the Project Dimension but I cannot get the SQL working correctly. 

 I have tried this

, isNull((select s.description
    from ip.structure s
    where s.structure_code=pv.overall_stat_comm), 'Unassigned') as [Overall Status Assessment]

 and I have tried this

,(select STRING_AGG(CONVERT(NVARCHAR(max),line_text), '') within group (order by isnull(line_number, 1) asc)
from ip.long_text
where key1 = 'overall_stat_comm' and key2 = pv.ppl_code) as [Overall Status Commentary]

As you can see, i’m feeling around in the dark here so any assistance greatly appreciated.

Best answer by Mario.munoz

At the bottom of the dataset you have the Null for the joins and unions. Since you added that attribute, you will need to add a ‘Null’ in single quotes but you need to add it before the last Null that is not in quotes (ex..Null). The null’s that are not in quotes are use for Dates or numbers. The ‘Null’ that are in quotes are used for text.

Let me know if you have any questions. 

Mario

This topic has been closed for replies.

10 replies

Thbutler
Gold Product Expert
Forum|alt.badge.img+2
  • Gold Product Expert
  • March 12, 2025

Would it make more sense to add it to the Project Assessment Dimension?  That dimension contains the Overall Status details.  We have some custom fields for status reports and that is where we added them


Mario.munoz
Silver Innovator
Forum|alt.badge.img+4
  • Silver Innovator
  • March 12, 2025

I have added a custom long text field to my Project Dimension and it is is similar to this one.

,(select STRING_AGG(CONVERT(NVARCHAR(max),line_text), '') within group (order by isnull(line_number, 1) asc)
from ip.long_text
where key1 = 'overall_stat_comm' and key2 = pv.ppl_code) as [Overall Status Commentary]

What error do you receive?


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • March 12, 2025

Thanks ​@Mario.munoz . that worked when I added it to the Project Assessment Dimension.  I agree with ​@Thbutler that this makes more sense but not sure why it didn’t work for the Project Dimension. Also, the only change I had to make was to add the underscores Overall_Status_Commentary

Cheers


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • March 19, 2025

Ok, I’m back again. this time I’m trying to add a CUSTOM long_text field to CRI Dimension in the ODATA feed.

I’ve tried this sql (copied from an existing line), with no success:

, (select ip.pfn_grs_scrub_nvarchar_html(line_text)

  from ip.long_text

  where key2=cri.cri_code and key1='issue_comments' and isNull(line_number, 1)=1) as [Issue_Comments]

When I test the query I get the message:

Conversion failed when converting date and/or time from character string.

Any assistance from a non-beginner would be appreciated.


Mario.munoz
Silver Innovator
Forum|alt.badge.img+4
  • Silver Innovator
  • Answer
  • March 19, 2025

At the bottom of the dataset you have the Null for the joins and unions. Since you added that attribute, you will need to add a ‘Null’ in single quotes but you need to add it before the last Null that is not in quotes (ex..Null). The null’s that are not in quotes are use for Dates or numbers. The ‘Null’ that are in quotes are used for text.

Let me know if you have any questions. 

Mario


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • March 19, 2025

thanks ​@Mario.munoz I was not going to work that by myself in a million years. 😆


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • April 8, 2025

Has anyone added custom Logbook fields to the ODATA feed?  I can’t see anywhere to do this. ​@Mario.munoz  ​@Thbutler  


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • April 10, 2025

For anyone stumbling on this question I raised. I have resolved this issue with the help of our Power BI experts.  All the custom attributes that are created using Logbook are automatically included in the ODATA feed and the data will be present in the dashboard tables after a successful refresh.  You will need to do some Power BI work however to get the custom attributes to appear in the LogItems table (which is what I was wanting to do). if anyone needs more info then reach out.


Thbutler
Gold Product Expert
Forum|alt.badge.img+2
  • Gold Product Expert
  • April 11, 2025

For anyone stumbling on this question I raised. I have resolved this issue with the help of our Power BI experts.  All the custom attributes that are created using Logbook are automatically included in the ODATA feed and the data will be present in the dashboard tables after a successful refresh.  You will need to do some Power BI work however to get the custom attributes to appear in the LogItems table (which is what I was wanting to do). if anyone needs more info then reach out.

That is good to know.  We’ve not implemented Logbook yet and was curious how we would pull this data into the reporting.  I’ve made considerable customizations to our Power BI and backend queries.  Is this data stored in existing tables or in new ones?


Forum|alt.badge.img+2
  • Author
  • Bronze Innovator
  • April 14, 2025

The logbook data is stored in new tables (outside of Portfolios) and you’ll see them all once you download and open the pbit file that has the logbook tables in addition to the existing dashboard tables.