Fetch data by date range using Interface Builder - cocoa

I have an NSTableView that is done using the typical IB and data bindings. It works well.
However I need to put in a Segmented Control to indicate date range. So for example, if user clicks on the "Last Year" segmented control button, the table should only display records for last year.
I looked at the data binding options in IB for the NSArrayController, but I have no idea how to do this.
Can somebody point me in the right direction please?
*Update:
The app I'm working on has 3 SegmentedControl buttons -- "This Year", "Last Year", "Total", and a tableview that displays the records associated with the year selection the user selected. So selecting the "This Year" will reload the tableview with records for the current year, and selecting "Last Year" will reload the table to show last year records.

You want to set a filter predicate. Your "last year" button would have to set the array controller's "filter predicate" to one that describes the appropriate date range filter.
Predicates Programming Guide
-[NSArrayController setFilterPredicate:] Source

if you got a field in your store called is isChecked that have data type bool you could do this in IB.
isChecked == 0

Related

Show predefined range options and calendar at the same time (daterangepicker.js)

Using the JS daterangepicker library I would like to show a list of predefined ranges AND a calendar picker at the same time. Currently, the intended behaviour is to only show the calendar when the "Custom range" option is selected, as stated on this related ticket on their repo. However, I find 'hard' to select some random single day in the past like this.
For example, imagine I have the following predefined ranges: "Today", "Yesterday", "This week" and "Custom range". In case I let my users pick 4 days in the past, they would need to:
Open the widget
Select "Custom range"
Select four days in the past as the starting range
Select four days in the past again as the ending range
These are 4 clicks for just picking a single date while giving the chance of predefined ranges! Why don't they show a simple calendar picker before clicking on "Custom range" to let users select a single date with just 1 click? Any ideas?
I have same functionality in my app, where a user can select a predefined range (e.g last 7 days, last month, last 3 months, last 6 months etc). What I have done is added a drop down with these options and whenever user clicks "Custom range" it opens date range picker.
Now whether we can display these in date range picker, some may argue that these ranges may vary a lot and setting these & populating in drop down via config seems out of scope for date range picker. But you may customize the lib to implement if you want.

How to click on Web Table column's Web Button in following case?

I have one web table, in this I want to delete particular record by clicking on record's delete button.
I got the value of row but I am not able to perform click on web button of particular row and also there is 2 buttons in one column.
How to click on delete icon of particular row?
You need to set a reference to the item within the specific row and then click on it - something like this:
Set oLink = Browser("myBrowser").Page("myPage").WebTable("myTable").ChildItem(iRow,8,"Link",0)
oLink.Click
You will potentially need to amend the "Link" and the number 8 in your own code. iRow represents the row you are trying to interact with.
Essentially what this code does is set an object reference to the first item of type "Link", in column 8 of the table, then uses a Click event to select it. If your delete icon is a WebButton, then replace "Link" with "WebButton" for example. The final 0 in the command tells UFT to select the first element matching the object type - you might need 1 if your two icons are in the same column of the table.
Let me know if that helped.

Add textboxes in last row of gridview

I am working on Windows Form app using C#. I have a gridview on my form that will contain 5 columns for Sr No, Item Name, Item Price, Item Qty and Item Amount. I want to have a set of five textboxes in the last row of my gridview so that I can enter my required values there and then upon entering the last value, the wholw row comprising of all the five items should get added to the gridview and again the last row should contains that set of textboxes for a newer entry. How can I achieve this?
Also is it possible to have the entries made in the gridview itself? I need to fetch entries from DB and after the user is done, the gridview entries will be stored again in the DB.
Please note that my app is WPF but for ease I have used Windows Form for just this Window.

Selection of radio group button with tag, using bindings

I am implementing a custom date range selector. The "from" part looks as follows:
A "to" section looks similar. When I select an end-date that is earlier than the starting date, I want to automatically switch the end date radiogroup to option 1 ("Custom") and put the "From" date in the calendar picker.
I have bound the starting and ending NSDate objects to the date pickers, and the tag values to the radio groups. I do not understand why the following does not result in a visible selection of the first button:
[self setFromTag:1]
Usually, the user still has a radio button pressed (not sure if that matters). Any help greatly appreciated!

Adding table cells with UIPicker values selected

I am struggling to think about the logic by how i can achieve this. Here's my question :
I am trying to add a picker view (plist) with 3 columns. wherein the second column is dependent on the first one and the third column independent.
say for example :
1st column: Country Name,
2nd column : State and
third with yes,no or both options.
Then click add button to save and display these selected values(of picker view).
I want to keep an add another button so that user can select another option from the picker view and display the selection again.
I wanted to know if later on the user wants to edit the selection made earlier than is it possible to auto-populate the options in the picker view for each of them, if selected, like, if i select first added value, then it will populate it in picker view, popping out from bottom and make changes and save it again.For e.g., If the user wants to change the value in third field later.
Sorry, but i am not getting, like is this possible or there is another way to do the same.
Thank you.
Yes, when you display the picker, you need to include code something like this:
// The first row in the first column should be selected
[myPicker selectRow:0 inComponent:0 animated:NO];
// Pick the second row in the second column:
[myPicker selectRow:1 inComponent:1 animated:NO];
// Pick the first row in the third column:
[myPicker selectRow:0 in

Resources