Sahi - get element using custom attributes or multiple attributes - attributes

I want to get an element in Sahi script using multiple custom attributes of my choice.
It is a <td > having different attributes which are dynamically generated. The title attribute is blank that is "". example of the element definition is as follow:
<td title="" rownumber="1" rmbnum="0,1" rowId="8090.9008.6352.8721" class="my-class my-class2" position="4">
Here the row id is dynamically generated.
I need to click on this element once this element is clicked then a textbox is generated and we need to fill value in it - value is text format.
I want to use rmbnum and position attributes to get this element.
I have searched the sahi forum but was not able to find it.
regards,
Rahul

You can use
_cell({rmbnum:"0,1",position:"4"})
The documentation has been updated now. http://sahi.co.in/w/browser-accessor-apis

You can also try use
_cell(_table(“items”), rowIndex, columnIndex)
_cell(_table(“items”), rowName, columnName)
See http://sahi.co.in/w/_cell for examples.

Related

Returning a quantity of 1 for specific items on an invoice with Freemarker

I'm using Freemarker in NetSuite's Advanced PDF/HTML templates to generate an Invoice. For specific item types, I want to display "1" instead of the actual quantity on the Invoice. This is based on the item category drop down field selection of "Services". My current attempt is below.
<#if record.custitem_item_category?string?contains("Services")>
<td align="center" colspan="3" line-height="150%">1</td>
<#else>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
</#if>
I tried validating the initial #if statement with ?has_content but it just skipped to the #else statement so think I've missed something there.
From the field name custitem_xx it sounds like you are trying to access a Custom Item Field. Two problems here. Firstly you need to read the value from each line (i.e. it should be item.item.custitem_item_category not record.custitem_item_category. But additionally (unless it's been recently fixed), doing so in NetSuite just returns the value from the first line of the sublist for every single line item.
What you need to do is create a Custom Transaction Line Field and source in the value from the item, which you would then access like item.custcol_item_category.
[When you create the custom field, uncheck Store Value to make sure it is always sourcing in the latest value, and also make sure it is checked under Screen Fields on the form to display in the UI - otherwise it is not available to your template either. If you do want to hide it in the UI, you can just blank out the label.]
Your if statement looks correct, which means that record.custitem_item_category?string?contains("Services") is not returning the value you think it is. Typically you would only use ?string on a number to convert it to a string, if it is already a string, this is unnecessary.
Try just printing out ${record.custitem_item_category} on each line and see what results you get. If some of them contain 'Service' then you should be fine with record.custitem_item_category?contains("Services") in your if statement.
Below thing works...
<#if item.colname=="Package"> (here you can set 1)
<#elseif item.colname=="Discount"/> (here you can set 2)
<#else>

TIBCO SPOTFIRE 7.5-How to set a document property with checkbox values

In TIBCO SPOTFIRE 7.5 I have a problem to set a document property with values selected in a checkbox: I have to use "OR" clause between 2 checkbox filter (it works always in "AND") so I want to set 2 document properties with checked values (2 checkbox) and use them in a limit expression.
Someone can help me?
Tnx
I will list two possible answers here, that differ in complexity. Which solution to use depends on how strong your requirements are on what UI control you can use.
Option 1 - Use Property Control
Add two property controls to a text area to set the document properties that will be used to limit data. Each property control will be set up to select values from a column in your data, for instance like this with the Film example data:
With two property controls as the one above, add a data limit expression to the visualization (Visualization properties -> Data -> Limit data using expression). Set expression like this:
[Actor] = "${Actor}" OR [Actress] = "${Actress}"
Here I've used the column [Actor] to match the value of the document property Actor or the column [Actress] to match the value of document property Actress.
Option 2 - Use JavaScript
If you really need the UI to be a checkbox, then there is no Spotfire Control to handle that. If the choices you need to allow the user to make is static, then this option is fairly straightforward. If you need the option to be based on the data, then it takes more work.
Let's start with the static case. In a textarea, add an input field and then modify the html to something similar to this:
<label><input type="checkbox" value="check1"> Checkbox1</label><br>
<label><input type="checkbox" value="check2"> Checkbox2</label><br>
<label><input type="checkbox" value="check3"> Checkbox3</label><br>
<div id='mySpotfireControl' style='display:none'>
<SpotfireControl id="344f7da2bc5d4baca88c7e76cb7d429b" />
</div>
Also add a javascript to the text area, similar to this:
$("input[type='checkbox']").change(function(){
var jsValue = $(this).val();
$('#mySpotfireControl input').val(jsValue).blur()
})
This will move the value from the checkbox into the Spotfire Document Property. From there, you can add a limiting expression same as when using solution 1 above.
If you need to generate the set of checkboxes that are available, then you need to generate the html for the text area dynamically. You can do this by writing an IronPython script that inspects the current data, and creates the html for the text area. This IronPython script would need to be invoced somehow, if you want it fully automatic you can trigger it from a data function that runs when the analysis is opened.

Dynamically set cell/row style jsf 2.0

I am using an h:datatable which shows a summary of the data entered by a user in a session. The rows of the table are deletable at the users discretion. if the data meets certain criterion, the specific row in the table must be in red font color, else it should be black.
The methods I have tried so far are:
- Set the style value for h:outputtext component in each column value to red programmatically. But this changes entire columns color.
- Set the rowclasses programmatically, this again changes the style for all previous rows.
I am unable to target just one row or cell. I thought about using javascript, but without the id of the component I am not sure how to get the element.
Thanks.
Use the rowClasses attribute.
<h:dataTable value="#{bean.items}" var="item" rowClasses="#{bean.rowClasses}">
The getRowClasses() must return a comma separated string of CSS class names which are to be applied on rows (more specifically, the <tr> elements) repeatedly. You can create it based on the items inside bean's (post)constructor, action methods and/or even inside the getter.
For some reason, the StringBuffer was being overwritten thats the reason the change wasn't showing. I went with a simpler approach of adding an alert img to the rows that needed to be modified.

formatting in Dreamweaver using the dropdowns

if I want to format a small snippet of text using the dropdowns (ie Heading 1, 2 paragraph), it often ends up changing the tag for a large snippet of text (or even half the page).
How do i change this behaviour?
When you select part of a tag in Dreamweaver and change the format, DW will change the format of the parent tag.
What you are describing requires a different technique as you are trying to get inline formatting. You need to select the text and then wrap it with a span tag (Danilo's advice is correct in that regard). You then apply the CSS style you want to the span tag to change the format.
So to style No longer want to receive these updates it would look like so:
<p>No longer <span style="font-size:18px;">want</span> to receive these updates?</p>
After DW gets through with it. In Design View after wrapping the text with span, select in the Tag Inspect and switch the Property Bar to CSS mode to style.
When used like this the property inspector will expand the selection to include the parent tag of the selected text, causing the selected option in the property inspector (p, h1, h2, etc) to replace the parent tag with the selected option. you cannot change this operation.
You can make a selection, hit CTRL+T (CMD+T I assume on Mac) which brings up the Wrap Tag editing option, type your tag, then hit enter and the selection will be wrapped with the tag of your choice.

Select the current value in a dropdownlist using XSL and SharePoint

I'm using the row edit template below. The problem I have is that the current value is not selected when the row edit XSL template is used. The value defaults to the first item in the list. What is the best way to get the current value to be the selected item in the template below? I thought having DataValueField="{#type}" and DataTextField="{#type}" would resolve the issue, but it does not.
<asp:DropDownList runat="server" id="ff3{$Pos}"
DataValueField="{#type}" DataTextField="{#type}"
__designer:bind="{ddwrt:DataBind('u',concat('ff3',$Pos),'SelectedValue','TextChanged','',string($XPath),'#type')}">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList >
Use DVDropDownList instead of DropDownList. See this MSDN forum post describing the same problem. I've done the same thing in the past and using SelectedValue with DVDropDownList is how I finally got it to work.
Try this:
<asp:DropDownList runat="server" id="ff3{$Pos}"
SelectedValue="{#type}"
__designer:bind="{ddwrt:DataBind('u',concat('ff3',$Pos),'SelectedValue','TextChanged','',string($XPath),'#type')}">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList >
DataValueField and DataTextField are used with data binding, but you are using a specific set of ListItems. Using SelectedValue should set the drop down list to the List Item's current value of type.

Resources