I need to extract all values, including the empty fields from the table, but the problem is that extract method skips empty fields. How can I collect those empty fields or replace them with something else?
Here is my expression for Scrapy shell:
row = response.xpath('//*[#class="apexir_WORKSHEET_DATA"]//tr//td//text()').extract()
Your xpath selector here selects text() values:
'//*[#class="apexir_WORKSHEET_DATA"]//tr//td//text()'
What you want to do is select td values and iterate over them:
items = []
rows = response.xpath('//*[#class="apexir_WORKSHEET_DATA"]//tr//td')
for row in rows:
text = ''.join(row.xpath('.//text()').extract())
items.append(text)
Now even if there is no text your code will append an empty string to your item list. Doing this with xpath alone is not possible unfortunately.
Related
I notice one fact that when predicate has dynamic field to compare then it doesn't work.
For example:
db:open("library")//book[$filterFields = $pattern]
for this I get 0 results,
but when I put for example category instead of $filterField then I have some results.
How can I use variable in predicate as field?
If $filterFields is supposed to contain a list of element names, you can possibly use the following query:
db:open("library")//book
[*[name() = $filterFields] = $pattern]
I have a form with a text-input element.
The user can enter values separated by commas like "a,b,c,d". In my model, there's a List which should then hold these values (which really are a list).
In Thymeleaf, how can I bind such a string and convert it to a list on submit? Is there something like a Converter interface?
In your Model instead of List you can use String to populate the input values. After you get the values, you can do following:
You will probably have a String something like this: "text1, text2, text3...". Then convert it to a List you can do something like this:
String value = "text1, text2, text3..."
List<String> inputs = Arrays.asList(value.split("\\s*,\\s*"));
The regex basically removes the whitespace and the comma. This should work fine.
How can I get text rendered in the cells? I have tried the following :
[1] $(gridId).jqxGrid('getcellvaluebyid', rowID, columnFields[j])
[2] $(gridId).jqxGrid('getcelltextbyid', rowID, columnFields[j])
However, I only get the actual values of the cells like flags and status codes instead of the actual flag names and status names rendered on the specific cell (using cells renderer).
Please help.
Have you tried by creating an Array variable and caching the cellsrenderer result using that Array. After that you can access the rendered cell content using your Array and your array keys.
I have a AttributeTextValue field that stores value for the attributes, The values are in following format , 001,002,003 and so on , and one single attribute can contain multiple values seperated by comma such as
AttributeValue = 001,002,003
and to split each of the text I have used str2con and this stores each value seperated by comma in a container , but issue I am facing is that str2con convert the text value to str and stores strings in container as follows : 1,2,3 but I want it to be same as 001,002 and 003 . How to accomplish this can any one help me out ?
Use str2con(value, ',', false) with parameter _convertNumericToInt64 as false.
With this parameter container elements won't be converted to integer.
How to show two records for given single search?
UI page contains millions of records.I need to show only two records instead of giving
single search.
using OR SEARCH or whatever use.I want to show two records.
And how can i give two values in single text box?
That dependa on you only, you can make use of some special charater to break two string like : or | so that you allow to etner two string like "abc|5678" than in back end you break this string in two string string1 = abc and string2=5678
Two values in single text box:
txt.Text = "value1" + "value2";