FileMaker Pro 14 - Pass Variable From Button Press - filemaker

I have a number of columns, and I want to be able to have the user press the label for each column to sort the data alphabetically\numerically by that field.
I can already accomplish this rather easily, but not very efficiently. I could make one script for each column and set it to sort by that column, perhaps even creating a global variable to keep track of the direction. Instead, I'd like to reduce it to one script and pass a variable to the script based on what button\label was pressed.
So far I've found people saying you can change the color of each one and get the variable that way, but I don't want the category headers to be different colors. Yes, I could simply use a one-step process for each one, but no way to reverse it when they click it a second time. Any ideas?

You can pass a script parameter where you specify the script to be performed on the button. From there, you can specify what field to sort on and if you like, set global variables for how the fields were sorted (order and name) that you can use in conditional formatting to give visual feedback.
There are lots of techniques out there for this, but this is one I have used especially for arbitrarily large data sets where sorts should not be done on calculations.

Related

Parameter Variation: Tracking the Metadata

I am trying to use parameter variation in AnyLogic. My inputs are 3 parameters, each varying 5 times. My output is water demand. What I need from parameter variation is the way in which demand changes according to the different combinations of the three parameters. I imagine something like: there are 10,950 rows (one for each day), the first column is time (in days), the second column are the values for the first combination, the second column is the second combination, and so on and so forth. What would be the best way to track this metadata to then be able to export it to excel? I have added a "dataset" to my main to track demand through each simulation, but I am not sure what to add to the parameter variation experiment interface to track the output across the different iterations. It would also be helpful to have a way to know which combination of inputs produced a given output (for example, have the combination be the name for each column). I see that there are Java Actions, but I haven't been able to figure out the code to do what I need. I appreciate any help with this matter.
The easiest approach is just to track this in output database tables which are then exported to Excel at the end of your run. As long as these tables include outputs from multiple runs (and are, for example, only cleared at the start of the experiment not the run), your Parameter Variation experiment will end up with an Excel file having outcomes from all the runs. (You will probably need to turn off parallel execution in the PV experiment so you don't run into issues trying to write to the same Excel file in parallel.)
So, for example, you might have tables:
run_details with columns id, parm1, parm2 and parm3 (with proper column names given your actual parameters and some unique ID generated for each run)
output_demand with columns run_id, sim_time_hrs and demand_value (if, say, you're storing some demand value each hour of simulated time) where run_id cross-references the run's ID in run_details
(There is extra complexity in how you could allocate a unique run ID and how and when you write to/clear those tables, but I'm just presenting the core design. You can also get round the need-serial-execution point by programmatically controlling when you export to Excel, rather than using the built-in "Export tables at the end of model execution" capability, but that's also more complicated.)

String collector/Constants in MDriven (For Time Picklists)

The goal is to create a date and time picker for a viewmodel in MDriven.
Date-wise, this is easily achieved by making set variable of date type.
When it comes to the time aspects, it seems to be a little more tricky since a time type does not exist, for obvious reasons.
(Yes, before you suggest so, I have already read How do I set Date AND time picker in MDriven? and it did not help fully.
Context:
We have tried to work our way around this by letting the user write their desired time in a column of Int-form and implementing constraints that disallows users to write something other than that of "hhmm". Whilst this worked, it is not practical and slows down the user-experience.
Ideally, we would like to have a picklist where the user gets to chose pre-made times (i.e 16:00, 16:30, 17:00 etc). This way, the format of the chosen time would never break the framework in which we want to make use of the time later on, since it is limited.
Question:
How could this be attained? Surely there is a way to create constants (like hard-coded, solely visible variables), or perhaps you could collect instances of string with a specific operator for this use?
I think you want a set of usual values to choose from. But possibly the chosen value could be changed by the user.
I would declare a class TimeValueStore. In this class I would have an attribute with only the time part set of a datetime, so 0000-00-00 16:00. I would add a admin UI to maintain these. (I can parse the DateTime back from a string with DateTime.Parse(vTimeStringValue)).
In the UI I can then have a combobox with TimeValueStore.allinstances.
When the user changes the picked value in the combo the value can be assigned to a viewmodel variable vPickedTime.
I would also have a DateTimePicker that sets a date in vPickedDate.
In a button named "Apply" I would have this expression: self.TheDateTimeFinallyChoosen:=vPickedDate.Add(vPickedTime)
This doesn't solve the pick-list problem, but take a look at the example in Derived Settable attributes in the MDriven Wiki.
Using derived settable attributes might be a good way to remove complexity from the UI controls.
https://wiki.mdriven.net/index.php/Derived_settable_attributes

How to assign values to checkboxes in CheckedListBox in Powershell studio

I have a CheckedListBox in my GUI that displays each one of the roles I need to present to the user, as pictured below:
Each one of these roles is tied to specific number in the database, as pictured here:
As you can see, the role AUDIT is assigned to the number 10. I need to reflect this in my GUI somehow. What I need is for the value of each of these check boxes in the CheckedListBox to equal one of these ROLESID numbers.
My dilemma is that I want to continue to use the CheckedListBox because of how easy they are to use. I could very well give each one of them their own individual checkbox and assign the values from there, but that's just a lot of bloated code. Is there a way to do this?

Access: Forms, Subforms and Queries

According to the searching I've done over the past couple of days, what I'm trying to achieve should be fairly straightforward but nothing that I've found has solved my problems. This is my first time at using Access, or SQL at all. Apologies in advance for the length of the question.
Essentially I need to pick up a value from one table and multiply it by another in the another table, and then store the result in the second table, via forms and subforms.
The Problem:
I'm attempting to create a database of projects, part of which is a quotation tool. The database has several tables covering all the required inputs for our project managers, most of which are linked to the PKs of their parent tables.
My current attempt has a form (frmJobDetails) giving the details of the each project (linked to tblJobs). This form has two subforms:
frmJobRolesSubform details who's working on the project in what role ( and, notably, their sale rate.
frmJobProcessesSubform details the tasks, who's allocated to which task and the estimated number of hours to complete.
Both subforms link to their own tables (tblJobs_Roles and tblJobs_Processes respectively).
frmJobProcessesSubform obtains the people working on the project and their roles from frmJobRolesSubform so the manager can allocate a person to a task on frmJobProcessesSubform. This is done via a combobox: cboRole.
So far, so good.
I'm needing to obtain the sale rate of the person working on the given task so that I can calculate the cost of the task. Specifically, I'd like a field on the subform to calculate the cost of the task and then store it in tblJobs_Processes.
My Attempts
I've attempted to build a query (qryProcessCost) that calls cboRole, either as an expression in the Field cell or in the Criteria cell ([Forms]![frmJobsProcessesSubform]![cboRole]).
I'm aware this can't successfully when the form isn't active, but I'm getting Access' request for input for [Forms]![frmJobsProcessesSubform]![cboRole] when selecting from the subform. The query runs successfully when example values are hardcoded into the query. The query should, obviously, only return a single value.
I've tried setting the ControlSource of a textbox to [qryProcessCost]![dblProcessCost] (where dblProcessCost is the calculated field), but this can't then write to the table (as far as I can deduce). Also, I get a #Name? error in the cell and I can't seem to get to the bottom of that.
I've tried setting the RecordSource property of a combobox to SELECT [qryProcessCost]![dblProcessCost] FROM [qryProcessCost], and the ControlSource to the relevant field of the table. While this would be a clunky solution, it actually doesn't work anyway as it fails to pick up the value of [Forms]![frmJobsProcessesSubform]![cboRole].
I've tried using an intermediate textbox to determine what value cboRole is passing, and I'm happy with that - the primary key of the role assigned in frmJobsRolesSubform.
The Question:
I'm guessing that I'm probably going to have to resort to VBA at this point to get what I want but I'm unfamiliar with the Access VBA structures (though I've used Excel VBA a fair bit).
Anyone got any ideas, hints, suggestions or pointers?
Cheers in advance,
Aaron
In case anyone else has a similar problem, I've posted my complete solution below:
I implemented Gene's correction to my references, which provided something, but the query wouldn't update when the fields on the form were changed. As I noted in the question, I also really wanted it to be a text box rather than a combo box for usability reasons but wasn't sure how to have a Record Source and Control Source for a text box.
I ended up going round in circles, via VBA and macros and several types of error and happened upon a suggestion to use a DLookUp here. I hadn't been able to get them to work for this particular problem before, but I managed to make it work this time. Specifically, I put the DLookUp in the following macro:
SetProperty
Control Name txtBudgetCost
Property Value
Value =DLookUp("[dblCostRate]","[tblJobs_Roles]","[pkJobs_RoleID]="[cboRole])*[txtBudg‌​etHours]
This macro was used for the After Update event of the relevant fields on the subform.
Setting the value property of a field to a DLookUp meant that I could set the Control Source property of a the text box txtBudgetCost to the relevant field in the table, to obtain the desired behaviour.
Both cboRole and txtBudgetHours are fields on the same subform as the field txtBudgetCost.
The only problem with this solution is that, when the subform is viewed in the Datasheet view, a #Name? error is given for the new record row. I probably just need to enter some error handling somewhere, though I haven't given much thought for what it should be just yet.
Cheers,
Aaron

SSRS Multiple parameters in single drop-down

I have a feeling I am probably out of luck on this one, but Is it possible to have more than one parameter in a single drop-down list on an SSRS report? For example, the drop-down could be titled shape/color, and when opened, the top of the list shows shapes, and one can be checked, then below that in the same list, is a list of colors, where one can also be checked. Possible at all?
It is really best to have separate drop-downs for each attribute, but within a single drop-down you would first set it to "Allow multiple values". You can setup your drop-down to be formatted so that the sections of available values are grouped together. Finally, you'll need to add a query or function to check that valid combinations were selected before trying to display the results. In other words, make sure only one shape was selected. You can set an error message with a visibility that toggles based on the selection. This is one method to do what you are looking for, but if you are new to SSRS, you will probably have more specific questions along the way. Once you have more details on a specific step, you can get help with that.