Triggers, performance and help with a replaceText script with start and end text matches

Mark Rauterkus mark.rauterkus at gmail.com
Sat Jul 6 20:05:10 EDT 2013


Hi LC Folks,

Our "Attendance App" for kids at our summer camp needs some serious
performance help. The hit is huge when we keep data from various fields
about a camper in various .txt files.

I think I need triggers so updates and refreshing the data only occurs when
desired, not at OpenCard.

Getting there I need to do some text magic in the trigger buttons with text.

Works: (but only does a fraction of what I want it to do)

on mouseUp, tPerformance
   put the text of field "field1" into tPerformance
   put replaceText(tPerformance, "Prior", "hello") into field "field2"
end mouseUp

But I want to use an expression with replaceText function. to eliminate
everything between two text markers.

Desired result is to remove all the text starting with "Prior data:" and
ending with "Concludes prior."

????

--- put replaceText(tPerformance, "Prior data: ..... and everything in
between and including .... "Concludes data." , "empty")


So, there could be a bunch of text and statements in a range that should
all be eliminated.



+ + + Example:

A Field has:

Prior data:
Ran 100 meters in 16.5 seconds on July 2.
Concludes prior.

Then new stuff gets entered into the field that falls outside the range of
Prior data .... Concludes prior.

Would be:
Prior data:
Ran 100 meters in 16.5 seconds on July 2.
Concludes prior.
Swam 200 yards July 10.

After the trigger, the update / sync results in field performance might be.

Prior data:
Ran 100 meters in 16.5 seconds on July 2.
Scored 5 goals in game on July 7.    <--- Updated from elsewhere.
Swam 200 yards July 10.
Concludes prior.

Summary:
LC scripts should eliminated the older / prior data locally, upload the new
content to the file AFTER the URL, and then Return the fresh data, perhaps
picking up any other changes that have since been put on the server too.
Then replacing / refreshing the data locally.

Thanks in advance.

+ +

Another option might be to use a repeat loop and set line to empty until it
hitting after line concludes prior. Not as happy with that.

Mark Rauterkus, Swim & Water Polo Coach
mark at rauterkus.com
Pittsburgh, PA, USA



More information about the use-livecode mailing list