I have a requirement where I want to hide a duplicate value from the domain(lookup of the field). For Example there is a synonym domain called status with 2 same values as Active, I want hide one of them to avoid confusion. How do I achieve this?
You may refer to this technote from IBM:
https://www.ibm.com/support/pages/node/229865
You can make a lookup like this:
<table id=mylookup mboname="SYNONYMDOMAIN"
inputmode="readonly" selectmode="single"
whereclause="domainid='MYDOMAIN' and SYNONYMDOMAINID in (select max(synonymdomainid) from maximo.synonymdomain where domainid='MYDOMAIN' group by maxvalue)">
...
</table>
Related
Currently I'm using jxls and it works just fine. The basic element I use is transformXLS from net.sf.jxls.transformer.XLSTransformer class. In the template I use </jx:forEach>. The simplest use-case, I think. The question is, can I hide columns and change their order dynamically ? I see setColumnsToHide() in aforementioned class so I gues it is possible (I am not sure though), but Is it possible to change column orders too ?
EDITED:
maybe I will ask about the same thing in a different way. Can I achieve that ${el.${col.rate}} in any way ?
<jx:forEach items="${cols}" var="col"> ${col.name} </jx:forEach>
<jx:forEach items="${elements}" var="el">
<jx:forEach items="${cols}" var="col"> ${el.${col.rate}} </jx:forEach>
</jx:forEach>
*${col.rate} is the column name for el
I have an HTML document which has different tables in it.
Simple examples include 2 types:
<table>
<table class="footer" id="some-x">
To select all nodes where the table has an attribute called id I can use
DocumentNode.SelectNodes("//table[#id]")
What I'm tying to figure out of the opposite, how do I select nodes where the tables do NOT have any attribute called id (or any class, i.e just bare tags) (example 1)
You can use not() to select tables that don't have any id attribute :
DocumentNode.SelectNodes("//table[not(#id)]")
...or to select tables without any attribute at all :
DocumentNode.SelectNodes("//table[not(#*)]")
Something like this might work here. Let me know if it doesn't
doc.DocumentNode.Descendants("table").Where(t => !t.HasAttributes)
I want to implement pagination in Play FrameWork , Is there any tutorial or example for this
I have explore there website and went through the tutorial but not able to implement pagination
Thanks
I have implemented many pages in play! using the Play pagination module. It's working fine with no issues. I'll give you an idea of what I did, below.
First I declare the ValuePaginator that points to a result set (in my case a MYSQL query)
ValuePaginator vpaginator=query.resultList();
Then render the Paginator instance to use it in the view
render(vpaginator);
In the view, I used the following syntax
#{paginate.list items:paginator, as:'r'}
<table>
<tr>
<td>${r[0]}</td>
<td>${r[1]}</td>
<td>${r[2]}</td>
</tr>
</table>
#{/paginate.list}
Suppose my SQL query looks like this
Select name,id,address from table
then in that case r[0] will take the value of names, r[1] will take the value of id's and r[2] will take the value of addresses and render this data in 3 different columns in a table.
Hope this helps.
First solution is to use the paginate-module. Furthermore there was a discussion of different implementations to solve it at google-group one result of it can find at the snippet-page.
I hope that one of the solution fits to you.
I have added the following field to a custom list definition based on custom content type.
<Field Type="User" DisplayName="Line Manager" List="UserInfo" Required="FALSE" EnforceUniqueValues="FALSE" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ID="{098E0A5A-8187-481E-B155-B674A406EEAF}" SourceID="{53ca79b7-9ffa-457d-aff8-c71508b09cb1}" StaticName="Line_x0020_Manager" Name="Line_x0020_Manager" RowOrdinal="32" Filterable="TRUE" FromBaseType="TRUE"/>
I am putting [Me] filter on this column in a view. The filter is not able to filter the records for the logged in user.
Am I missing something?
EDIT
Interestingly if I add similar column through SharePoint UI the filter works fine. Any clues, ideas welcome.
Is the [Me] filter work on native list definition?
Or, are you sure that your SharePoint installation using English version?
Maybe you should change field type from "User" to "people or group"
Phew!! This got resolved and was one of the most frustrating things. I am not sure if this was an issue with the way I defined the schema below or whether it’s a bug with SharePoint.
I ran a profiler to see what’s going on under the hoods and found a query (pretty huge for me to digest ) where in the RowOrdinal was being used extensively with a predefined value as 0 or 1. As I was using “32” as RowOrdinal, it looked shady to me. I changed it to “0” and bingo!! The filter started working.
BTW here is what MSDN says about it – "Optional Integer. Specifies the database location for the field."
Doesn’t appear like it should take part in records filtering.
So, to close the field should be defined as
<Field Type="User" DisplayName="Line Manager" List="UserInfo" Required="FALSE" EnforceUniqueValues="FALSE" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ID="{098E0A5A-8187-481E-B155-B674A406EEAF}" SourceID="{53ca79b7-9ffa-457d-aff8-c71508b09cb1}" StaticName="Line_x0020_Manager" Name="Line_x0020_Manager" RowOrdinal="0" Filterable="TRUE" FromBaseType="TRUE"/>
I understand why this is happening but I need a work-around. I looked into some other questions on StackOverflow but none of them was helpful. I do not want disable input validation throughout the whole website because that is definitely dangerous. I have only one (at least for now) place where I need to disable input validation.
I decorated the Action Method with [ValidateInput(false)] attribute, and I'm encoding the strings with Html.Encode. But still, I get the same error. Here's my view:
<div id="sharwe-categories">
<ul class="menu menu-vertical menu-accordion">
#foreach(var topLevel in Model)
{
var topLevelName = Html.Encode(topLevel.Name);
<li class="topLevel">
<h3>
#Html.ActionLink(topLevel.Name, "Index", "Item", new { category = topLevelName }, new {#class = "main"} )
</h3>
<ul>
#foreach (var childCategory in topLevel.Children)
{
var childcategoryName = Html.Encode(childCategory.Name);
<li>#Html.ActionLink(childCategory.Name, "Index", "Item", new RouteValueDictionary { { "category", topLevelName }, { "subcategory", childcategoryName } }, null)</li>
}
</ul>
</li>
}
</ul>
</div>
As you can see, there's no user input. But some of the category names have some "dangerous" characters in them... Any solutions?
Although Darin's answer is perfectly feasible, I wouldn't recommend using Scott Hanselman's technique of turning all this validation off step by step. You will sooner or later end up in deep...
Second suggestion of using IDs along with dummy strings (which are great for SEO and people) is a way to go, but sometimes they're not feasible either. Imagine this request URL:
/111/Electronics/222/Computers/333/Apple
Although we'd have these IDs we can rely on and human/SEO friendly category names as well, this is definitely not desired. ID + Dummy string is feasible when we need to represent one single item. In other cases it's not. And since you have to display category and subcategory, this is a problem.
So what can you do?
Two possible solutions:
Cleanup category names to only have valid characters - this can be done but if these are not static and editable by privileged users, you're out of luck here, because even if you've cleaned them up now, someone will enter something invalid later
Cleanup your string on the go - When you use category name, clean it up and when reading it and using it (to get the actual category ID) you can compare provided (previously cleaned) category name with value in DB that you clean up on the fly either:
now while filtering categories
before when generating category names
I'd suggest you take the 2.2 approach. Extend your DB table to have two columns:
Category display name
Category URL friendly name
you can also set a unique constraint on the second column, so it won't happen that two of your categories (even though they'd have different display names) would have same URL friendly names.
How to clean
The first thing that comes to mind is to strip out invalid characters, but that's very tedious and you'll most probably leave something out. It's much easier and wiser to get valid characters from your category display name. I've done the same when generating dummy URL category names. Just take out what is valid and bin the rest. It usually works just fine. Two examples of such regular expressions:
(\w{2,}) - only use letters, digits and underscores and at least two of them (so we leave out a or single numbers and similar that doesn't add any meaning and unnecessarily lengthens our URL
([a-zA-Z0-9]{2,}) - only letters and digits (also 2+)
Get all matches in your category display name and join them with a space/dash and save along with original display name. A different question of mine was exactly about this.
Why an additional column? Because you can't run regular expression in SQL server. If you're using MySql you can use one column and use regular expression on DB as well.
Even though you shouldn't do it this way...sometimes there is not an easy way to get around it. requestPathInvalidCharacters on the httpRuntime tag in web.Config is what you seek. Just enter the following into the <system.web> section:
<httpRuntime requestPathInvalidCharacters="<,>,*,%,:,\" />
I would highly encourage locking this down using the following instead:
<location path="the/path/you/need/to/lock/down">
<system.web>
<httpRuntime requestPathInvalidCharacters="<,>,*,%,:,\"/>
</system.web>
</location>
Just toss that into the root <configuration> tag. That way...you're not opening your entire site to allow for ampersand's in the path...and potentially exposing the entire site to an unforseen attack.
You may find the following blog post useful about using special characters in urls. But in general it is best practice to replace those titles with slugs the same as StackOverflow does with question titles in the url for better SEO and use ids to identify them.