[Human Readable Change History] Problem with attribute names that starts with ST, EN or RC (these are stripped...)

[Human Readable Change History] Problem with attribute names that starts with ST, EN or RC (these are stripped...)

  
Forge Component
(20)
Published on 2017-11-28 by Johan den Ouden
20 votes
Published on 2017-11-28 by Johan den Ouden

In the extension with the DiffEntities method there is the following code:

private string FormatFieldName(string originalName)
{
if (originalName.StartsWith("ssST") || originalName.StartsWith("ssEN") || originalName.StartsWith("ssRC"))
return originalName.Substring(4);
else
return originalName.Substring(2);
}

So if the attribute name starts with ST, EN or RC it is being stripped of the attribute name but we do have attribute names that start with these characters.

In the function '"Translation_BuildChangedString_Record" the query "GetEntityAttributes" fails because the characters are stripped off the attribute name.

Why are these characters stripped off the attribute name?

Johan,

"ST", "EN" and "RC" are prefixes used internally by OutSystems to indicate structures, entities and records(?) respectively. So if you create a structure "MyStruct", it will be known as "STMyStruct" internally. This way you can have structures and entities with the same name.

I'm not too familiar with the internals of other data structures in OS, so I don't know what the "else" case is for. If indeed it strips "ss", the code is indeed not able to distinguish between a structure called "Hello" and another object names "STHello".

Thanks for your reply.

We have a attribute RCNOutgoing and we get back NOutgoing.

So there is really a problem here. Stripping the ss is fine but not the RC, now ssRC is stripped instead of ss only.

I would say that the problem is that the function was created to be generic and used on any name, despite the type of object.

The only way to prevent ssRC to be striped from an attribute name (that starts with RC, for example), is to change the function to identify the object type (entity name, field name, etc).

Cheers,
Eduardo Jauch