提取子表从表中的iMacros
问题描述:
这是从那里我试图提取子表从表中的iMacros
我试图提取数据 我只是想从一个表中提取子表下建筑详细信息类别的webpage
TAG POS=1 TYPE=H2 ATTR=TXT:Building<SP>Details
TAG POS=R1 TYPE=TABLE ATTR=TXT:* EXTRACT=HTM
SET txt1 {{!EXTRACT}}
SET count_txt EVAL(("var n=\"{{txt1}}\";var a=n.match(/<table class=\"table table-bordered table-responsive table-striped\">/g) || []).length;a;")
PROMPT {{count_txt}}
在这段代码中,我第一次计数文本'<table class=\"table table-bordered table-responsive table-striped\"'
的发生,并在此基础上努力泼了HTM,然后提取数据,但是这是给我的错误
MacroSyntaxError: wrong format of SET command, line 4 (Error code: -910)
我试图让这样的事情
Sr.No. Project_Name Name Number of Basement's Number of Plinth Number of Podium's Number_of_Slab_of_Super_Structure Number_of_Stilts Number_of Open_Parking Number_of_Closed_Parking Sr.No. Apartment_Type Carpet_Area_(in Sqmts) Number_of_Apartment Number_of_Booked_Apartment
1 SERENE CITY SERENE CITY A-01/A-02 0 1 0 2 0 0 0 1 VILLA 2BHK 234.3 2 0
2 SERENE CITY SERENE CITY A-03/A-04 0 1 0 2 0 0 0 1 VILLA 2BHK 234.3 2 0
截至本记录有... 任何帮助将非常感激。
感谢
答
使用我的宏这将是非常乏味的事情,因为只有一个表,有一个重复的图案,我已经写了一些CSS中,你可以得到只有你通过副本所需的线糊。
说明:
你需要该行是该系列1,5,9,......所以我用的是第n个孩子选择器(检查出来here),这将只显示想要的行。然后,表格内的所有tr被设置为不显示,这将隐藏它。
tbody > tr:nth-child(4n+2) {
display: table !important;
}
tbody > tr {
display: none !important;
}
答
这应该工作(“count_txt”必须被预先定义,“m”是与相应的类表中的号码,“i”是表中内的行数这种情况),但是您需要手动添加列标题:
for(m=1;m<=count_txt;m++){
var macro;
var rows=10;
var tag = "TAG XPATH=\".//body/descendant::table[@class="table table-bordered table-striped"][{{m}}]/tbody/tr[{{i}}]/td[3]\" EXTRACT=TXT"
macro = "CODE:";
macro += tag;
iimPlay("CODE:ADD !EXTRACT {{!m}}");//row#
for(i=1;i<=rows;i++){
iimSet("i",i);
iimPlay(macro);//extract data
}
iimPlay("CODE:SAVEAS TYPE=EXTRACT FOLDER=* FILE=MyTable.csv");//save
}
@deepesh这个答案对您有帮助吗? –