kendo Grid - Sub column values got wrongly mapped when reordering the Column - kendo-ui-grid

Here below link for code
http://dojo.telerik.com/AguGO/2
1) Drag the column header "Ship Address" along with its sub columns to two columns before.
2) After dragging is done, the sub column values are wrongly placed.
enter image description here

Related

Can't get textboxes to autofill from a listbox

I have a form called frmReferrals that has three text boxes bound to fields on a table called tblReferrals. I’m trying to use a listbox called List_HRPO to autofill the three textboxes. The source for the listbox is three columns from a table called tblStudies. I want the user to click on a row in the listbox and auto fill the three text boxes. I also need those values to be written to frmReferrals. Simple, right?
Here’s my code:
Private Sub List_HRPO_Click()
Me.hrpo_number = Me.List_HRPO.Column(0)
Me.hrpo_short_title = Me.List_HRPO.Column(1)
Me.ccir_number = Me.List_HRPO.Column(2)
End Sub
Here’s my problem:
With the textboxes bound to the table, when I click on a listbox row I get:
“Run-time error '-2147353567 (80020009)': Cannot enter value into
blank field on 'one' side of outer join”
I’m not basing anything off a query, so I don’t understand where this “outer join” is. I can avoid the error by unbinding the textboxes. The textboxes auto fill as expected, but the values in the textboxes aren’t being written to the table.
I’d greatly appreciate any help. I'm missing a deadline because of this! Thanks.

Getting a Value if a Field and Record number is known?

Good Evening,
I am working on a Combo Search Form that is designed to search for information by criteria. The form has a combo box containing field values and a text box beside it. The selection of a field value in the combo box will fill in the text box beside it with the relevant information for that record, all the relevant information is contained in the PetTable.
I have managed to get the combo box to display the fields from the PetTable by setting the rowSource to PetTable and the sourceType to Field List... however that's where I hit my dead end.
In the Text Box beside the combo-box I tried grabbing the value of the combo box and putting it into the textbox by making the Text box control source "=ComboBox", however this just created a textbox which has a literal text string to that of the combo box.
My next thought was to make the text box Control source "=PetTable.PetComboBox" my thought was that the PetTable references the table with my information and the "PetComboBox" becomes the field a need to get. This did not work either and gave a #Name error"
What should be happening is: In the Combo-box if I selected [Pet Name], I would hope that the textbox beside it becomes "Fido" but instead it also becomes [Pet Name].
Any and all help would be appreciated!
Thanks
Desired Effect
What you need to do is to change the Row Source Type of the Combo Box to "Table/Query". Then in the "Row Source" click on the "..." to open up the Query Builder. Select the table that you want. Add the columns that you want. I would suggest the table's primary key PetID, and then any other fields - in your case at least PetName. You may also want to sort by PetName to make it easier for the user to scroll through. Close the Query Builder and save the changes. Change the combo box's ColumnCount to 2, and set the Column Widths to be "0cm;6cm" (setting the first column to have a width of 0 means that it is not displayed to the user).
Now move to you TextBox, and set the Control Source to be:
=[Combo0].Column(1)
Note that columns in a combox box are 0-indexed, so the first column is column 0, the second (in your case containing PetName) is column 1.
As you actually want to show the field names, rather than the data in the combo box, then you will need to set the RowSourceType to be "Field List", and then select the table name as the RowSource.
You will then need a small piece of VBA to lookup the value of that field in the table for the current record:
Sub sListFieldData()
If Not IsNull(Me!Combo0) Then
Me!Text2 = DLookup(Me!Combo0, "tblPet", "PetID=" & Me!PetID)
Else
Me!Text2 = ""
End If
End Sub
And you will then need to call this procedure in the combo box's AfterUpdate event (to catch when it has been changed by the user) and also in the form's Current event (to catch when the user moves between records):
Private Sub Combo0_AfterUpdate()
Call sListFieldData
End Sub
Private Sub Form_Current()
Call sListFieldData
End Sub
Regards,

Adding an item to the end of a multi-column listbox

Being a beginner in this, I've tried to search for a solution to my issue. I created a form in Access 2013 with a List Box. The List Box is bounded to a table with 10 fields.
For the List Box, in the Property Sheet, I've set the Column Count to 10, but have hidden some columns, i.e. some has a Column Widths of 0" because I'm only showing important data in the List Box.
The Row Source Type of the List Box is set to Table/Query.
When I open the form, it queries the table and populates the List Box with all data.
I have 4 unbounded Text Box that allows the user to enter data, and have a button to allow the input data to be added to the end of the List Box and also be automatically added to the table.
I've searched for how to do this:
Add items to a multi-column List Box
vba listbox multicolumn add
Adding items in a Listbox with multiple columns
Adding values multiple columns to listbox in form access vba
Excel multi-select, multi-column listboxes
I've tried to use the .List property of the List Box, but it does not exist.
I've tried to do something like:
Me.MyList.AddItem "" & ";" & Me.textBoxValueOne & ";" & Me.testBoxValueTwo & ";" & ""
However, VBA complains I need to change the .RowSourceType to Value List, and when I added it, the List Box clears all the data, and adds this data as the first entry, which is not what I want.
I've added the following code, which adds a blank entry to the end of the List Box as well as table, but I don't know where to go further with it to save the input data from the Text Box to the end of the List Box and table:
DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdSaveRecord
Me.MyList.Requery
How can I achieve this?
Thanks.
You need to add the record to the table first and then requery your listbox.
After adding the new record try
Me![column name] = textbox1.value
And other textboxes
Followed by your save command.
Once you've added the record. Simply requery the listbox.
Me.listbox.requery

Datagridview - fill row from Combobox

I have set a combobox to be visible in column1 of my Datagridview. Now I'm trying to fill same row of Datagridview where Combobox appears, from Combobox_Key_Down event. This is my code for showing combobox:
Private Sub My_DGV_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles MY_DGV.CellMouseClick
If e.RowIndex >= 0 Then
With My_DGV
If .Columns(.Rows(e.RowIndex).Cells(e.ColumnIndex).ColumnIndex).Name = "Column1" Then
.CurrentCell = .Rows(.CurrentRow.Index).Cells(.CurrentCell.ColumnIndex)
Show_Combobox(.CurrentRow.Index, .CurrentCell.ColumnIndex) 'function that shows my Combobox in that cells
Combo.Visible = True
Else
Combo.Visible = False
End If
End With
End If
End Sub
I tried many things, but I don't know how to determine in which row Combobox appears and how give that Datagridview row my Combobox values. Someone please give me a clue of what should I do. Thanks in advance !
The first problem with your approach is that the DGV can have only one DataSource: it can either show the m:m association table or the related elements. If you include columns from one of the tables into the query for display, the table becomes non updatable and users can be confused why they cannot edit something they can see. It seems of little value they way you describe it, since they cannot see the detail data until after they make a selection.
Next, it requires another datatable to supply the details for CboColB. Since you want the DGV bound to a DataTable easy updates, you end up having to poke data into cells over and over.
Finally, consider what the user is confronted with. Using a Country table (200+ countries/locales with ISO code and name) and a list of flag colors, a table for CountryFlagColors will have hundreds and hundreds of rows (at just 2 colors per flag).
A better display might be to filter the m:m table (flagcolor) to a selected item so the user is only confronted with the data subset they are currently interested in:
The datatable used in the DGV is built from the m:m table:
The Country column is hidden.
When they choose from the CBO at the top, that is used as a RowFilter to limit the rows to the relevant ones.
In the RowValidating event, when the country cell is DBNull, copy the SelectedValue from the country combo to the DGV cell to fill in the blank
I would probably really make the user click a button and manually add a row so I could seed the country value then rather than depend on events.
It uses a DataAdapter and after adding X number of flag definitions, da.Update(dtFlagColors) applies/saves all the changes.
Ok, so that provides the core functionality to assign N color selections to define the flag colors for a country. The missing element is the 'details' for the Color item.
I added a meaningless int and string item to the Color table, one way to display these would be to create an alias in the SQL with the important details. Displaying them as discrete elements can either make the query non updatable or invites the user to edit things they cannot edit here. My silly SQL:
"SELECT Id, Name, Concat(Name , ' (' , intItem , ' ' , stritem,')') As Info from FColor"
Then use 'Info' as the display member on the CBO column in the dgv:
dc = DirectCast(dgvCF.Columns(0), DataGridViewComboBoxColumn)
dc.DataSource = dtFlagColors
dc.DisplayMember = "info"
dc.ValueMember = "id"
dgvCF.DataSource = dtSample
The combo column has its own datasource of course, in order to display one thing and use another for as the Value to give back to you. Result (the values are silly):
It is not exactly what you want, but comes close and is much simpler. It also requires almost no code for driving the associative entity. Another alternative would be to use a DGV as the second picker so you can show the extended data and manually add rows to a DGV:
If you set the dropdown style to Nothing, it looks like a text column.

Vlookup for InfoPath 2010

I'm trying to develop a calculator type from in InfoPath where the user will be asked to end weight,height, and age. I will then take those values and use them to look up other values that are based on that number. For example if the column headers are Gender, Age, Height, L, M, and S. I want to find the 'L,M,S' values associated with that height. All values in the case are different. So if height were 45, L=-1, M=1, S=2; if height were 50, L= -2, M= 5, S=3.
In excel you a Vlookup with the syntax of :
Dim A as double
Dim Height as double
height = txtHeight.Value
A = Application.WorksheetFunction.VLookup(height, Range("C2:F652"), 2, False)
This would give you the "L" value for the row in which that height is located.
How can I do this in InfoPath? I have seen that are cascading queries you can do for dropdowns and comboboxes, but I want them to be able to type in a value, find a value on a SharePoint list based on that number and then return that number to another text box to use for my calculation.
If the values you want to look up are in a SharePoint list, then you need to create a data connection to that list. Make sure to include all the fields you need. Don't load the data connection at form load.
Let the user enter the height. Create a rule for the height field that fires when the field changes. Add an action that sets the query field for the secondary data source to the value of the height field, then query the data connection. Now the secondary data source contains the record with that height and the fields in the secondary data source contain the values. You can copy the values into text boxes on the canvas.
More details:
After you have set up a data connection to the Heights list, click the Heights field and add a rule by clicking New > Action.
Click the Add button and add an action to set a field's value.
Click the button next to the "Field" text box. If you don't see the top drop-down to select a different data source than the main data source, click the "Show Advanced View" link. Select the secondary data source for the Heights list, open the node for queryFields and the node below that and select the Height field.
Click the fx button next to the "Value" text box, then click "Insert Field or Group" and select the "height" field of the main data source.
OK out of all dialogs.
Add another rule to query for data.
Select the secondary data source to the Heights list.
Add another rule to set a field's value. For "Field" select the main data source field into which you want to copy the looked up value. For "Value" select the secondary data source and drill into the dataFields node until you see the field names. Select the desired field and OK out of all dialogs.
The rules panel should now look similar to this, but with your column names.
Test the form. Enter a valid height into the height field and click out of the field. The corresponding value from the height list will be written into the textbox. The screenshot shows the SharePoint list in the background with the item for heigt "66" highlighted. The value returned to the InfoPath text box "getV1" is from the "V1" field of the SharePoint list.
Hope that makes it clearer.