[ObjectDiff] Option to display attribute 'Label' instead of 'Name'
objectdiff
Service icon
Forge component by Stuart Harris
Application Type
Reactive

Hi Stuart,

Thanks for sharing this amazing module.
We have a use case to show the attribute 'Label' instead of 'Name'. Due to naming convention sometimes the attribute name is not that user friendly.

Do you consider to include an option to use attribute's label name in future release?
Thanks.

Regards,
Soon

Hi Soon,

Thank you for your message and your kind words.

I am confused by the question because the attribute Label is actually used to identify the label.  Is there something I am missing?

You can try the demo app here Home (shkiandra.outsystemscloud.com) 

Kind regards,

Stuart

Hi Stuart,

Thanks for your reply. The demo result is something I am look for.

For example "Is Active" I believe it is coming from Attribute Label field instead of Attribute Name since it is with space.


I was trying to download the demo from forge unfortunately it is an empty application. Can you please share a copy of working demo? Thanks!

Following is the "Label" field I refer to. In table Entity_Attr it is referring to Default_Label column. Basically what i am looking for is to have option to return "Label" value in the comparison result instead of just "Name". 


Thanks.

Regards,
Soon

Hi Soon,

The demo is available from the forge when you select download component and demo

Using CompareObjectsConfig should give you the results you are looking for


ObjectDiffDemo1.0.0O11.oap

Hi Stuart,

Thanks for you response. Yeah I have downloaded the demo from the Forget and using the one you have attached. Some how I cannot open the OAP file and it has error. 

Anyway I have unzip the OAP file and get the OML to deploy.

I found the result is different from your demo  at Home (shkiandra.outsystemscloud.com)   

For the attribute name I can see it is showing "IsActive" instead of "Is Active" from your demo at Home (shkiandra.outsystemscloud.com)  .


Regards,
Soon

Ok, thanks Soon!

My apologies, maybe I have updated it after uploading the last version.  Thanks for identifying the problem.

I am currently having a problem accessing my personal environment so will upload a new version once that is resolved.

I hope this helps!

Kind regards,

Stuart

Thanks! 

By the way I found an error being thrown from "GetLabelForEntityValue" server action under "GetValues" step. I have check the table name and it has no issue. One thing to call out is my environment is having 5 databases (on-prem). But I have installed this module within same database for the static entity table having error. 

Hope your latest version will resolve this issue too. I am studying your code to find out how this dynamic SQL is working and it could be useful for my other projects. 

Thanks again!

Regards,
Soon

Thanks Soon,

Would you be able to let me know what the correct table name is for that entity and what type of database you are using?

Kind regards,

Stuart

Hi Stuart,

I found this error in Service Center. The table name being constructed is correct and I can use the same the table name SQL Studio. We are in SQL Server 2016.

[2] Error in advanced query GetValue in GetLabelForEntityValue in Gravity_ObjectDiffLib (SELECT @AttributeName  FROM OSUSR@TableName  WHERE Id = @RecordId): Invalid object name 'OSUSR_gq9_RatePlanBillingSystem'.

The only call out is the table is in another database catalog called "fuxxel" instead of main database catalog "outsystems". Would this make a different? 

From the query it does not include any logical database I am assuming it will refer to main db catalog (outsystems)? I will try to do a test to another static entity table locate in main db catalog to find out whether will hit same error.


Regards,
Soon

Hi Soon,

Thank you that information is incredibly helpful!

Yes, the database catalog would explain why the SQL is failing.

I will investigate and see if I can make it work with the different catalog.

Kind regards,

Stuart

Hi Soon,

Apologies for the length of time for me to investigate, but I have time now.

I haven't been able to find out how to write an advanced SQL and dynamically determine the catalog.

So instead, I plan to check if the table exists first, so it still returns the diff of the entity, but doesn't find the label values when the foreign key table is in a different than the standard catalog.

I hope this will work for you and others using different catalogs.

Kind regards,

Stuart

Hi again Soon,

I have just published the new version.  I have changed it so that if the referred table is not found, the id is displayed, so a SQL error does not occur. If you are available to give it a try, I would be keen for some feedback.

However, I suspect you will have moved onto using a different library due to how long I took to fix the issue.  If you have, thats ok, I hope it is working out for you!

I hope this helps.

Kind regards,

Stuart

Hi Stuart,

Thanks and sorry for late response.

Apparently I found we can join to DBCatalog entity and this is working for me.

I need a few more features in this in order to make use this to capture audit trail in my current project.
Hence i have branch our your previous version and to add in additional features..

  1. Return a field value from FK table for a given FK column. This is utilising same idea from static entity.
  2. Only compare a list of fields instead all.
  3. Support external table (via Integration Service) since all external table's entity field does not have label or field name stored under entity_attribute table. 

I am still performing unit testing and if you interested in this I can share you a copy.
Thanks again for your help.

Regards,
Soon




Hi Soon,

Thats great, thank you for sharing your code. I don't have access to an environment using a different catalog, so this is very helpful.

I will look into external tables for you.

To only report on specific attributes, is it that there are common attribute you would like to ignore (eg CreatedDateTime, ChangedDateTime) or does it differ for each entity?  I am trying to decide whether to have an option to include or exclude attributes.

Kind regards,

Stuart

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.