Custom NSTableViewHeaderCell - macos

I've created a custom NSTableViewHeaderCell class but I still have one issue with separators: How know if I am drawing the last column header or not?
Actualy I don't want to draw a separator for the last column but I didn't found a way to know it is the last one.
Thanks for your help

Since you're creating a subclass of NSTableHeaderCell, create one more property on it for a NSTableColumn. You can set this property as you create and set an instance of your subclass for each of your table's columns.
Now that your subclass instances know the table columns to which they belong, they can use this to determine the table view. From the table view, you can get an array of table columns, and if you compare a given table column to the lastObject value of that array, you should be able to tell if your header cell belongs to the last table column.
If you choose to enable reordering for your table columns, you may have some more coding to do, but this should get you started.
Good luck to you in your endeavors.

Related

What table holds the category selections for the time_card table in ServiceNow

I'm using the ODBC connector to query time card data from the time_card table in ServiceNow, and there are two columns I'm wondering about: category and dv_category - those two fields are pulled from somewhere, and I do not know where. Is there are table that holds these values, or are they static on the UI and passed through?
The 'category' field is just a string(40) with a Choice List local to the field. So, it's not a reference field, just a drop down. The Choice List can be modified
I'm not finding the 'dv_category' field on the time_card table and I'm on Helsinki Patch 3. Can you clarify?
Editing to add the actual answer to the question : 'I believe the table you're looking for is called 'sys_choice''

Translate column name from one language to another

Is it possible I can translate column name from one language to another.
For example:
In one of our application, DB columns named in polish.
I want, for example when I give select * from table_name. I can read column name in English.
Create view on the top of your original table and give access to your users just to the view. For the end users hide your real table. You can map columns from original table to view column names that will have national characters.
I think the quickest way to do this is to define views (some sort of wrappers over the tables). However, this will lead to extra maintenance, as each schema change in the source tables will require a change in the correspondent view.

Oracle forms hybrid validation

This is my first post ever and haven't come across any other questions related to this. I am attempting to try and create a hybrid validation type and add it to an existing oracle form. We have a super/subset type of thing going on. When one chooses something from a dropdown, there are 5 options. If 4 of those options are chosen, the data is pulled from one validation table dataset, table A. If the other option is chosen, it comes from a different table's dataset, table B. These (along with others items) are saved in Table C. Table C has a FK constraint regarding these validations. I have added another column to table C to attempt to bypass the FK constraint, but the field still tries to save in the FK column. I can't seem to figure out if I need to add a database trigger, an item level trigger, or a form level trigger to reroute the data to correct columns in the database. Thanks in advance for any help!
If your items are select lists, you would use an item level trigger (when-validate-item) on the superset list item to populate/repopulate the list for the subset item.
Alternatively, you could use a popup LOV on the subset item which has a query which is filtered by the value of the superset item.

Dynamically setting MaxLength property of a DataColumn with DataAdapter

I have a datatable that I'm filling with SqlDataAdapter.Fill(). Is there a way to dynamically assign the MaxLength property to each string datacolumn to the maximum allowed by that column in the database?
So I googled for a while and found that the DataAdapter has another method besides Fill which is: FillSchema(), which includes the database schema into the DataTable. Since all I wanted to bring was the MaxLength property what I did was load the schema into another table and loop through the columns assigning the value to each one.
Of course if you wanted to keep all the constraints in the database within your table, then you'd need no loop and just load the schema into the datatable.
PedroC88's answer worked. To clarify the code needed for any newbies. Just above my adapters fill method, I wrote the fillschema method. The (SchemaType)2 argument is required. There are 2 different schematypes (1 and 2) and 2 is recommended as it applies existing table mappings (though I have no idea what this means).
myAdapter.FillSchema(dataTable, (SchemaType)2);
myAdapter.Fill(dataTable);
In this code 'myAdapter' is the name of my adapter and 'dataTable' is the name of my data table.

TableAdapter to return ONLY selected columns? (VS2008)

(VS2008) I'm trying to configure a TableAdapter in a Typed DataSet to return only a certain subset of columns from the main schema of the table on which it is based, but it always returns the entire schema (all columns) with blank values in the columns I have omitted.
The TableAdpater has the default Fill and GetData() methods that come from the wizard, which contain every column in the table, which is fine. I then added a new parameterized query method called GetActiveJobsByCustNo(CustNo), and I only included a few columns in the SQL query that I actually want to be in this table view.
But, again, it returns all the columns in the master table schema, with empty values for the columns I omitted.
The reason I am wanting this, is so I can just get a few columns back to use that table view with AutoGenerateColumns in an ASP.NET GridView. With it giving me back EVERY column i nthe schema, my presentation GridView contains way more columns that I want to show th user. And, I want to avoid have to declare the columns in the GridView.
When you add a new query to a given TableAdapter, it is going to assume the schema in which it is attached to, which is why you are getting blank values for the columns you don't want.
Since you mentioned having already created the procedure, what you need to do is use the Server Explorer to connect to the database and simply drag that stored procedure over into your XSD work area. What this will do is create a separate QueryAdapter that will have just the columns you specified (still strongly typed) and you can bind/interact with your GridView using that QueryAdapter instead.
Is the strongly typed dataset used in another query that returns all the rows from the table?
What you could do is create a dataview using the strongly typed dataset and expose a data table for your DataGridView.
I'm not sure what your requirements are totally, but this example should help you:
DataView dv = new DataView(ds.<Your_Table>);
// This will create a new data table with the same name,
// But with only two columns from the original table.
// This could then be bound to your data grid.
DataTable dt = dv.ToTable(false,
ds.<Your_Table>.<Your_Column1Column>.ColumnName,
ds.<Your_Table>.<Your_Column1Column>.ColumnName);
Just delete the columns you don't want at run-time before you bind to your Gridview. The underlying class is still just a DataTable after all.

Resources