How can I save a global Variable

I have one page with:

activity: ~@ACTIVITY@~ (occour one time)

Companie = ~@NAME@~
address = ~@ADDRESS@~
phone = ~@PHONE@~

Companie = ~@NAME@~
address = ~@ADDRESS@~
phone = ~@PHONE@~

Companie = ~@NAME@~
address = ~@ADDRESS@~
phone = ~@PHONE@~

When I scrap the page the Activity appear only one time, than when I save in database activity save only in the first record.

How can I save ~@ACTIVITY@~ in a Global variable ?

You can save it as a session

You can save it as a session variable by double clicking it and selecting the save as session variable. You can then access it in a script by session.getVariable("sessionName");

angeloalves, Seamus has a

angeloalves,

Seamus has a good suggestion, however, you will need to reference your session variable a bit differently than he suggests (*see below).

I would add to his suggestion that you create two extractor patterns. In the first one include only one token that will extract the ACTIVITY data. As Seamus suggests, save it as a session variable.

activity: ~@ACTIVITY@~

Then, create another extractor pattern and in it include only one of the three blocks of NAME, ADDRESS, & PHONE. If you test that extractor pattern you will notice that all three blocks of data is extracted.

<p>Companie = ~@NAME@~<br />
address = ~@ADDRESS@~<br />
phone = ~@PHONE@~</p>

Now, for the second extractor pattern call a script "After each pattern match". In this script, reference the ACTIVITY variable (*session.getVariable("ACTIVITY")) each time you save your NAME, ADDRESS, PHONE combinations to your database.

-Scott

Thanks Scott

Scott,

Look my script bellow:

activity=session.getVariable("ACTIVITY");

I Called "After each pattern Match"

but save only activity the first time in database, the others records are without activity.

Thnaks

angeloalves, I did not see

angeloalves,

I did not see your script in your last post but you seem to be referring to it.

It also seems like you're saying you are calling your script after your first extractor pattern (which attempts to extract the ACTIVITY data). Instead, as I mentioned before, I would recommend calling your script after your second extractor pattern and not your first.

Your second extractor pattern will not attempt to extract the ACTIVITY data, but instead will attempt to extract the NAME, ADDRESS, & PHONE data.

Because you will be saving the ACTIVITY data in a session variable you can refer to it each time you call your script (which is being invoked from the second extractor pattern).

-Scott