Author Topic: Text Replacement Feature - Default "No Hit" value  (Read 3265 times)

Offline FairfieldPhoto

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Fairfield Photography, LLC
Text Replacement Feature - Default "No Hit" value
« on: December 25, 2006, 07:58:43 PM »
A few weeks ago, I used the Text Replacement feature on a running race to substitute in the last names of the athletes so I could generate an ordering website with Runner Number and name.  Unfortunately, due the large number of day-of entries the promoter had, he did not give me a complete list of all athletes with their race numbers.  This resulted in a lot of "no finds" in the text replacement process.

Can you please create an option where I could define a default value for situations where the text replacement engine doesn't find a hit in any of the associated files?

Possible design solutions are:
1) A value that could be set in the preferences
2) A text replacement file named something like "no-hit.txt" that contains a string to be returned if no values are found in the other replacement file(s).
3) A code value for the last line of the last replacement file such that if the text replacement engine hits that line, it knows nothing else was found and to return the associated value on that line.

I am sure there other ideas as well and perhaps I am missing the capability to do that already through some other means.  If so, I have no doubt someone will correct me in the forum within the next 72 hours. <grin>

Thanks!
-Mike

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20927
    • View Profile
    • Camera Bits, Inc.
Re: Text Replacement Feature - Default "No Hit" value
« Reply #1 on: December 25, 2006, 09:01:05 PM »
Mike,

A few weeks ago, I used the Text Replacement feature on a running race to substitute in the last names of the athletes so I could generate an ordering website with Runner Number and name.  Unfortunately, due the large number of day-of entries the promoter had, he did not give me a complete list of all athletes with their race numbers.  This resulted in a lot of "no finds" in the text replacement process.

Can you please create an option where I could define a default value for situations where the text replacement engine doesn't find a hit in any of the associated files?

Possible design solutions are:
1) A value that could be set in the preferences
2) A text replacement file named something like "no-hit.txt" that contains a string to be returned if no values are found in the other replacement file(s).
3) A code value for the last line of the last replacement file such that if the text replacement engine hits that line, it knows nothing else was found and to return the associated value on that line.

I am sure there other ideas as well and perhaps I am missing the capability to do that already through some other means.  If so, I have no doubt someone will correct me in the forum within the next 72 hours. <grin>

You're talking about "Code Replacement" right?

While I see where you're coming from, there are certain instances where one wouldn't want missing codes to return a default replacement.  For instance you can use a variable like {object} in a code like so:

\{option}\

which will be "late evaluated" and the value that the option variable turns into will be evaluated as a code and its replacement will be inserted in place of the code.

I suppose as long as the code has a set of {} around it, the no-hit would be deferred.  Once the final replacement is looked up, then the no-hit could be returned.

Let's think about this some more...

-Kirk

Offline FairfieldPhoto

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Fairfield Photography, LLC
Re: Text Replacement Feature - Default "No Hit" value
« Reply #2 on: December 26, 2006, 03:58:20 PM »
Yes, I meant Code Replacement.

I used the "late evaluation" method the last race by coding the runner's number into supplemental category 2 then in Special Instructions, had a string that said "Runner - \{supcat2}\ - Number {supcat2}" which resolved to something like "Runner - Smith - Number 205" that I would then use as a section heading on the ordering website.  If, however, runner number 205 wasn't in the database I received from the promoter, then I would get "Runner \205\ - Number 205" when it would be have been better to have it say "Runner - NAME UNKNOWN - Number 205", where the string "NAME UNKNOWN" (or whatever string I specified) was associated with any code replacement that had a "no-hit" in the replacement file.

Perhaps a design that would allow this default to be optional would satisfy all needs.  Maybe a code of "~~~~" would mean the default
"no hit" code in the text file and then any text associated with that code would be the default replacement.  If you didn't want the default, you could just leave out the "~~~~" from the text file and it would behave as it does today.

Thanks for your consideration...

-Mike