Tag Select works but select wrong entry

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
masc
Posts: 3
Joined: Thu Dec 09, 2010 4:17 pm

Tag Select works but select wrong entry

Post by masc » Thu Dec 09, 2010 4:34 pm

Hi,

I'm having problems with Tag/Select functionallity, macro runs (doesn't fail) but the outcome is that it selects the wrong entry from a list. It seems to do with the fact some list entries are having the same characters at the beginning.

Can anyone please help me? I already tried the $ % and * possibilities but no luck so far....

Thx!


I ve got the following script:
======================================

Code: Select all

VERSION BUILD=7021019 RECORDER=FX
TAB T=1

' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
'CSV = Comma Separated Values in each line of the file
CMDLINE !DATASOURCE GrpMembers.csv
'Number of columns in the CSV file. This must be accurate!
SET !DATASOURCE_COLUMNS 3

'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL3}}scripts/home.aspx

'Select Application
TAG POS=1 TYPE=A ATTR=TXT:Beheren<SP>persoon
TAG POS=2 TYPE=TD ATTR=ID:button_text_td_
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:frmForm ATTR=ID:mdw_personeelsnr CONTENT={{!COL2}}
TAG POS=3 TYPE=TD ATTR=ID:button_text_td_
TAG POS=1 TYPE=DIV ATTR=TITLE:Selecteren&&CLASS:icon<SP>icon_zoom_in
TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=$*{{!COL1}}*
TAG POS=3 TYPE=TD ATTR=ID:button_text_td_

'Back to homepage
URL GOTO={{!COL3}}scripts/home.aspx

'Write to logfile
SET !VAR1 {{!NOW:yyyymmdd_hhnnss}} 
ADD !VAR1 " Member "
ADD !VAR1 {{!COL2}}
ADD !VAR1 " connected to group "
ADD !VAR1 {{!COL1}}
SET !EXTRACT {{!VAR1}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Create_GrpMembers.log
=======================
Everything works fine untill there are entries in a dropdown wich are more-or-less the same.

The problems occurs in this line: "TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=$*{{!COL1}}*"

if gbr_gbg_id contains entries which are almost the same then it selects the wrong entry. With the below mentioned CSV it selects "BVM-AUTORISATIE Beoordelaars" in both cases

The csv input I'm using is:
"Group","Member","TargetEnvironment"
"BVM-AUTORISATIE","P03167","http://xxxxx/"
"BVM-AUTORISATIE Beoordelaars","P03167","http://xxxxx/"

The list entries of gbr_gbg_id are:
<option value=""></option>
<option value="1">IAM Portal TAB</option>
<option value="2">Security Services</option>
<option value="9">IAM Portal TAB Beoordelaars</option>
<option value="10">Security Services Beoordelaars</option>
<option value="11">ITNL-AUTORISATIE Beoordelaars</option>
<option value="12">ITNL-AUTORISATIE</option>
<option value="13">3BS-BG-1</option>
<option value="14">ABC-GR1</option>
<option value="15">BI4ZM-BG1</option>
<option value="16">BONO-GR1</option>
<option value="17">CORE BILLING / BRM-GR1</option>
<option value="18">DND-BG1</option>
<option value="19">EORDER-GP1</option>
<option value="20">FLEXUS-GR1</option>
<option value="21">FMS Mobiel GR1</option>
<option value="22">FMS MOBIEL TELFORT GR1</option>
<option value="23">FMS VAST GR1</option>
<option value="24">FORT-GR1</option>
<option value="25">G-IS-GR1</option>
<option value="26">G-IS-GR2</option>
<option value="27">HPQC-GR1</option>
<option value="28">UP-HVB-BG-1</option>
<option value="29">DEMOAPP1a-GR1</option>
<option value="39">BVM-AUTORISATIE Beoordelaars</option>
<option value="40">BVM-AUTORISATIE</option>
</select></span>

This is what is printed in the log if a run the macro (as you can see COL1 contains different values:
"20101209_172812 Member P03167 connected to group BVM-AUTORISATIE"
"20101209_172815 Member P03167 connected to group BVM-AUTORISATIE Beoordelaars"
siniy
Posts: 118
Joined: Sat Nov 07, 2009 7:44 pm

Re: Tag Select works but select wrong entry

Post by siniy » Fri Dec 10, 2010 1:50 am

If you have exact matching values in your column and drop down list, why are you using wildcards?
Replace

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=$*{{!COL1}}*
with

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=${{!COL1}}
masc
Posts: 3
Joined: Thu Dec 09, 2010 4:17 pm

Re: Tag Select works but select wrong entry

Post by masc » Fri Dec 10, 2010 7:57 am

Hi Siniy,

Thx, You are right but the wildcards are part of one of my attempts to solve the problem.... but didn't work!

Before this attemp I had as you suggested and it didn't solve the problem...

Any other ideas?

Thx!

Regards,

Marco
masc
Posts: 3
Joined: Thu Dec 09, 2010 4:17 pm

Re: Tag Select works but select wrong entry

Post by masc » Fri Dec 10, 2010 8:20 am

Hi All... I dubble checked my situation...

Siniy was completly right! In saying:
Replace
Code: Select all
TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=$*{{!COL1}}*
with

Code: Select all
TAG POS=1 TYPE=SELECT FORM=NAME:frmForm ATTR=ID:gbr_gbg_id CONTENT=${{!COL1}}
So my problem is solved...

Thx Siniy!
Post Reply