You could use PI Analysis with an expression like if 'Flag' then 'Name1' else 'Name2' and set it to run once a day. That would not demmand much from Analysis.
Unfortunately that cannot be implemented on Formula data Reference since it does not support string attributes.
However you could also separate your string builder attributes into subattributes like the example below if the tags always have the format you mentioned (that would demmand more effort to configure).
Only one Default Name attribute needs to be created with the following configuration.
- If Flag is 1 the Delimiter attributes would both be set as "Client Tag Delimiter" and Field1 would be set to "%Element%".
- If flag is 2 Delimiter1 would be set to "", delimiter2 would be set to "." and Field1 would be set to "".
So that the expression '.|Field1';'.|Delimiter1';"%Element%";'.|Delimiter2';'Attribute1'; would render the correct tag name.
Hope this helps.