Wildcard in QuotedString

Posts   
 
    
Jazz
User
Posts: 63
Joined: 12-Aug-2005
# Posted on: 05-Feb-2006 14:15:22   

Hi there,

is it possible to add wildcard to quotedstrings. i want to handle all relations that end with a certain string like: *Translation so its something more like EndsWith

<[If Not StringValueEquals StringValueName QuotedString]> text <[EndIf]>

Regards, André

Edit: It could also help if one was able to concatenate the currentEntityName with a custom string to look for.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 05-Feb-2006 16:34:03   

If possible, try to use .ltp include templates, which offer a much more fine-grained control of what you can access.

Frans Bouma | Lead developer LLBLGen Pro
Jazz
User
Posts: 63
Joined: 12-Aug-2005
# Posted on: 05-Feb-2006 17:15:46   

I used to do that kind of stuffs with codify before, here's my result in tpl fashion.

<%  EntityDefinition currentEntity = ((Hashtable)_activeObject)["CurrentEntity"] as EntityDefinition;
    foreach(EntityRelation relation in currentEntity.Relations) {
        if(relation.RelationType == EntityRelationType.OneToMany) { 
            EntityDefinition relatedEntity = relation.RelationEndPoint;
            if(relatedEntity.Name.EndsWith("Translation")) {%>
        /// <summary>
        /// Returns Translation of <%= currentEntity.Name %> in specific language.
        /// </summary>
        /// <param name="languageToken">Language of the translated <%= currentEntity.Name %></param>
        /// <returns><%= relatedEntity.Name %></returns
        public <%= relatedEntity.Name %>Entity Get<%= currentEntity.Name %>Translation(string languageToken) {          
            foreach(<%= relatedEntity.Name %>Entity entity in <%= relatedEntity.Name %>) {
                if(entity.LanguageToken == languageToken.ToUpper()) {
                    return entity;
                }
            }
            return null;
        }<% 
            } 
        } 
    }%>

Regards, André