Q.reloadLookup() with new set of FilterField - serenity-platform

Hye, how can I use Q.reloadLookup() and at the same time, I want to change the FilterField (add more field and condition).

Related

Set Column Property for a column in a revision table

I am trying to set column property for a column called "description". I tried using IRevisionTableAnnotation and TableAnnotation to identify the table and neither of them have a command that lets me set the column property.
IRevisionTableAnnotation does let me set a custom property through SetColumnCustomProperty, but i want to set the column property given by default and not use custom column properties.
Is there any way I can assign the column properties available by default?
setcolumntype2 attribute for TableAnnotation will let you set the default properties for the table (Parameter to be entered in integer).

Go next in datagridview [duplicate]

This code
CurrentSelectedRow = Me.dgvPreviouslyCut.CurrentRow.Index
stores the current selected row that has been clicked by the user in a data grid view control .
After refreshing the datasource for the data grid view, this code
Me.dgvPreviouslyCut.Rows(CurrentSelectedRow).Selected = True
programmatically re-selects the same row.
Immediately afterwards though
Me.dgvPreviouslyCut.CurrentRow.Index
is always set to zero, NOT the variable CurrentSelectedRow as you would expect.
Why does programmatically setting the select row index not cause the property CurrentRow.Index to be set to the same?
CurrentRow is the row containing the currently active cell. When you bind the DataGridView to an external data source, this property is reset to its default value which is the first cell in the first column.
SelectedRow is the row which is currently selected/highlighted. It may be one or more rows depending on MultiSelect property. To select a row you have to set its Selected property to true.
By setting the row as selected you merely keeping it highlighted not making it active.
To retain the current cell you have to store the Current cell's row and column index. To get them use the CurrentCellAddress property. Once your refresh the DataSource set the CurrentCell property using these indexes.
dataGridView1.CurrentCell = dataGridView1.Rows(rowindex).Cells(columnindex);
The DataGridView creates a new CurrencyManager when the data source is changed. If this CM contains items, the default position is 0, thus pushing this to the DGV and selects the first row.
To fix this, just set the position of the CM instead:
Me.dgvPreviouslyCut.DataSource = my_new_datasource
Dim cm As CurrencyManager = CType(Me.BindingContext(my_new_datasource), CurrencyManager)
If ((Me.CurrentSelectedRow > -1) AndAlso (Me.CurrentSelectedRow < cm.Count)) Then
cm.Position = Me.CurrentSelectedRow
End If

Xpages Getting Dojo Combo Box to have drop down

I am writing an Xpage in which the user can create a new document. On field is a category field. I want this field to be a drop down or type ahead with the possible values to be based upon previous entries. The user should also be able to add a new entry.
So this is the equivalent to a traditional dialog list field with "formula for choices" and the formula comes form the first categorized field on a view, with the "Allow values not in list" checked.
I am using a dojo Combo Box, but it displays the values in the field itself, instead of in a drop down.
Not sure what I am doing wrong:
My code is
<xe:djComboBox id="djComboBox2"
style="width:400px">
<xe:this.value><![CDATA[${javascript:var tmpView:String = "tipsByCategory";
var tmpColumn = 1;
var tmpVals = #DbColumn("",tmpView,tmpColumn);
tmpVals}]]></xe:this.value>
</xe:djComboBox>
In djComboBox
property value does the data binding to a document's field or a
scope variable
property selectItems has to deliver the list of possible entries
user can choose from.
Your code should look like this then:
<xe:djComboBox
id="djComboBox2"
style="width:400px"
value="#{document1.yourField}">
<xp:selectItems>
<xe:this.value><![CDATA[${javascript:
var tmpView:String = "tipsByCategory";
var tmpColumn = 1;
var tmpVals = #DbColumn("",tmpView,tmpColumn);
tmpVals}]]></xe:this.value>
</xp:selectItems>
</xe:djComboBox>

vb.net change value of a cell in a databound datagridview

I have a datagridview that has been populated from a datatable using the datasource property. I need to change the value of a cell without affecting the database. So far I could only find that I have to first change the databound item but no information about how to do that. Besides, I don't want to change the databound item.
The reason for wanting to do this is that I have a list of records with a start and end time and there is a computed field that gives the difference in seconds. I need to change the value of the computed field and change the height of the row accordingly, that is, the height of each row is proportional to the duration it represents. Changes are done from a text box which increments quickly if the "increase" button is kept down and therefore I cannot change the database with each increment. Rather I would change the value in the table frequently and update the database once the increments stops.
I have tried updating the datagridview directly using this code:
dgvTasks.Rows(SelectedRowIndex).Cells(5).Value = DateAdd(DateInterval.Minute, DateDiff(DateInterval.Minute, CDate("00:00:00"), CDate(txtDuration.Text & ":00")), dgvTasks.Rows(SelectedRowIndex).Cells(4).Value)
But receive the error:
System.Data.ReadOnlyException: Column 'Column1' is read only.
I also tried updating the datatable, and allowing the calculated column to update:
dtblTasks.Rows(SelectedRowIndex)(5) = DateAdd(DateInterval.Minute, DateDiff(DateInterval.Minute, CDate("00:00:00"), CDate(txtDuration.Text & ":00")), dtblTasks.Rows(SelectedRowIndex)(4))
dgvTasks.DataSource = dtblTasks
But the calculated value doesn't change.
I am also providing an additional calculated value (in the SQL) where I find the difference in minutes and the append a string literal to that:
( CAST ( DATEDIFF(MINUTE, Tasks.TaskStart, Tasks.TaskEnd) AS NVARCHAR(10) ) + ' mins') AS TaskDurationString
Is there a way to detach the grid from the datasource but still keep the data visible in the datagrid and manipulate it (without affecting the databound object)? Or perhaps some other approach to this problem?
Updating the calculated column in the DataTable should work - I've just tried it, and both when I edit one of the values that are part of the calculated value, and when I change the value in code, that column is recalculated and the grid UI updates.
One thing to check is that you are calculating the value correctly. You should be using the DataTable~ column [Expression` property]1. Something like this:
dt.Columns["FullName"].Expression = "FirstName + LastName";
Since it appears that you don't actually need to bind any of these values to the DataTable or persist them to the database, one possible solution is to do all of this in an unbound DataGridView calculation column.
To do that add a column using the designer, then in the cell validating event have something like this:
void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.Rows[e.RowIndex].Cells["TargetColumn"].Value = dataGridView1.Rows[e.RowIndex].Cells["FirstName"].Value.ToString() + dataGridView1.Rows[e.RowIndex].Cells["LastName"].Value.ToString();
dataGridView1.Rows[e.RowIndex].Height = dataGridView1.Rows[e.RowIndex].Cells["LastName"].Value.ToString().Length + dataGridView1.Rows[e.RowIndex].Cells["FullName"].Value.ToString().Length;
}

how to set initial value to variables in iReport?

In iReport 3.6.7, I am trying to use a Double variable. I want it to have an initial value of 0 or 0.00.
At present, no initial value has been set, so it displays null in the report. How can I make it have an initial value if no value has been explicitly specified?
Here's how to do it in iReport:
Click on the variable on the Report Inspector window
On the Properties window, set the Initial Value Expression to new Double(0.0)