Question
Hello,
How can I accomplish this?
I have a group of topics, called
CruiseNbr9200 through
CruiseNbr 9299. I also have another group called
OnboardPgm9200 thru
OnboardPgm9299.
They are related by the number (
CruiseNbr9214 goes with
OnboardPgm9214, etc).
I have a search that finds all the
CruiseNbrXXXX topics and returns a topic link & a pattern from the text in that topic in a table.This works fine.
I want to add to this search, to return some text from the corresponding
ProgrammingXXXX file in that same table. I want to return the rest of the line after the text "Theme: "
So I am trying to nest this search inside the other one.
The 2nd search works fine standalone, outside of its "nest":
%SEARCH{ ".*" topic="OnboardPgm92*" scope="text" regex="on" nosearch="on" nototal="on" format="$pattern(.*?Theme\:\s*([^\n]*).*) "}%
But not inside the other search (returns nothing)
%SEARCH{ ".*" topic="CruiseNbr92*" order="$topic" scope="text" regex="on" nosearch="on" nototal="on" format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: %SEARCH{ ".*" topic="OnboardPgm$percntCALC{$REPLACE($topic, 0, 10)}$percnt" scope="text" regex="on" nosearch="on" nototal="on" format="$pattern(.*?Theme\:\s*([^\n]*).*) "}% | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE(\$topic, 0, 10)}$percnt]] | "}%
I also tried
%SEARCH{ ".*" topic="CruiseNbr92*" order="$topic" scope="text" regex="on" nosearch="on" nototal="on" format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: $percntSEARCH{ $quot.*$quot topic=$quotOnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt$quot scope=$quottext$quot regex=$quoton$quot nosearch=$quoton$quot nototal=$quoton$quot format=$quot$pattern(.*?Theme\:\s*([^\n]*).*) $quot}$percnt | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE(\$topic, 0, 10)}$percnt]] | "}%
escaping everything but it also returns nothing.
I'm a little confused with the different kinds of escaping... $percnt, \ - maybe this is my problem?
Can someone help?
Thanks!
Kathy
Environment
--
KathyDeLaCruz - 29 Oct 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Note: I also just tried something I'd missed in
FormattedSearch - putting
$nop% to escape the }% sequence
But still no luck.
-- KathyDeLaCruz - 29 Oct 2008
I'm not sure that $quot works in that context. Also, \$ doesn't escape a $ sign, you need $dollar.
How about this:
%SEARCH{ ".*"
topic="CruiseNbr92*"
order="$topic"
scope="text"
regex="on"
nosearch="on"
nototal="on"
format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: $percntSEARCH{\".*\" topic=\"OnboardPgm$percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt\" scope=\"text\" regex=\"on\" nosearch=\"on\" nototal=\"on\" format=\"$pattern(.*?Theme\:\s*([^\n]*).*) \"}$percnt | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt]] |"
}%
-- SeanCMorgan - 29 Oct 2008
Thank you for your extremely quick reply!
But it still does not work ...
I made a mockup in the sandbox - much easier to see than here.
If you have a moment, check out KdlcCs2009
You should see results returned for 9201 and 9204. But the Theme does not display.
-- KathyDeLaCruz - 29 Oct 2008
There were a few things going on:
-
Cruise\:\s didn't match, because there was no colon in the text of the topic.
- Your first screenshot shows 201 instead of 9201 because you only needed to replace 9 characters
- Most importantly,
$ in the nested SEARCH had to be escaped as $dollar.
- SEARCH defaults to
scope=text, and nonoise includes nosearch and nototal. I used those to shorten this a bit, so there is less escaping to do and it's a bit easier to read.
These cruises sound great! Have I earned a discount yet
-- SeanCMorgan - 01 Nov 2008
Thank you! You're a genius & I really appreciate your time - I was so frustrated, but I knew it had to be possible!
Slowly I will get this regex/search stuff....
If I were in charge of discounts, you'd DEFINITELY have one -- but I'm pretty low on the totem pole here
-- KathyDeLaCruz - 03 Nov 2008