Skip to main content
Solved

How to add a CUSTOM field to the ODATA stream


Forum|alt.badge.img

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

View original
Did this topic help you find an answer to your question?

Thbutler
Silver Product Expert
Forum|alt.badge.img+2
  • Silver 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
Gold Active Participant
Forum|alt.badge.img+2
  • Gold Active Participant
  • 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
  • Platinum Active Participant
  • 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
  • Platinum Active Participant
  • 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
Gold Active Participant
Forum|alt.badge.img+2
  • Gold Active Participant
  • 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
  • Platinum Active Participant
  • March 19, 2025

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings