Is it possible in Netlogo to show the output (using print command) in table format i.e. row and column.
For example,In simulation, a day has 24 hours and in each hour there are five different attributes i.e. windspeed, temperature, humidity, visibility, and rainfall. Is it possible to show value of hours in rows and attributes values in column by using print statement or by other statement?
From the variable names, I am assuming these are global variables rather than something attached to any particular agent. And also assuming that each hour is a tick. In this case, you could have a statement like the following in the setup procedure to provide headings:
type "Windspeed" type "Temperature" <other headings> print "Rainfall"
then a similar statement in the go procedure to provide the variable values each tick
type windspeed type temperature <other variables> print rainfall
That would output it to the window at the bottom of the interface. If you want it in a widget, have a look at the output-type and output-print commands.
Related
Self-taught at SPSS here. Need to know the appropriate syntax to recode four DATE variables into one, based on which would be the latest date. I have four DATE variables in a dataset with 165 cases:
wnd_heal_date
wnd_heal_d14_date
wnd_heal_d30_date
wnd_heal_3m_date
And each variable may or may not contain a value for each case. I want to recode a new variable which scans the dates from all four and only selects the one that is the latest and puts it into a new variable (x_final_wound_heal_date).
How to use the SELECT IF function for this purpose?
select if function selects rows in the data, and so is not appropriate for this case. What you can do is this instead:
compute x_final_wound_heal_date =
max(wnd_heal_date, wnd_heal_d14_date, wnd_heal_d30_date, wnd_heal_3m_date).
VARIABLE LABELS x_final_wnd_heal_date 'Time to definitive wound healing (days)'.
VARIABLE LEVEL x_final_wnd_heal_date(SCALE).
ALTER TYPE x_final_wnd_heal_date(DATE11).
This will put the latest of available date values in the new variable.
I need to create a Dimension (calculated field) that depends on a filter.
My dataset has four columns: ID (Int), Variable Name (String), Value (Int) and Client ID (String). For each client ID there will be a value for each type of variable.
There are 6 types of Variable Name, and for each row there is unique ID.
I'm using a filter by Variable Name so there is one, and only one variable type available at the same time.
In order to display it in a stacked bar chart by that dimension, I have created this calculation field (In reality if has six IFs, but I'll use just one to illustrated it):
IF ATTR([1 (ML_Output)].[Variable Name])= "Interest Rate" THEN [Interest Rate] END
That way, when the filter is in "Monthly Interest Rate", the ATTR function should show the only type of variable available in the Variable Name field, which would be "Monthly Interest Rate". The problem is that it shows the "Cannot mix aggregate and non-aggregate arguments with this function" error.
I've been trying to solve this with many tutorials, but none of them work for one reason of another.
Any ideas?
EDIT:
PS: The original calculation that was doing what I wanted used a Parameter. However, since parameters won't update automatically when the dataset changes, I can't use it anymore. The original calculation was:
IF [Parameter 1]="Interest Rate" THEN [Interest Rate] END
I need the calculated field as a dimension. So, if I aggregated the result of the calculation, then it would be a measure, and that can't be used to create a stacked bar.
My end goal is to have a box change color when the last 3 records input into a field (based on the time of input) in FileMaker achieve a certain criteria (ex. variance < 2). I would like to know how to make this happen, or how a calculation/script can be written to only look at the last 3 records.
There are several ways you could approach this. A simple one would be to use a script to:
Show all records in the given table;
Unsort them (assuming they were entered in chronological order; otherwise sort them by creation timestamp);
Omit all records except the last three;
Get the value of a summary field defined as Standard Deviation of your value field;
Set a global variable/field to the square of the returned value.
Then use the global variable/field to conditionally format your "box".
If you don't want to use a script, you will have to define a relationship in order to get the last three values in the table, regardless of the current found set and/or sort order. Or you may use the ExecuteSQL() function for this.
I was wondering if there is any way to have a predefined name for behaviorspace result column name, for example if one of the outputs is count agents with [some condition] , instead of Count agents with [some condition] column name be The condition .
Currently I have defined a global variable with my desired column name and I update it at the end of experiment run, but if my experiment ends with an error, I will get zero instead of that variable. Is there any other way for having proper column name?
Thanks :)
Define a procedure:
to-report the-condition
report count agents with [...]
end
then in the BehaviorSpace experiment, change the metric to the-condition.
I want to use one parameter for date and another one for time in my reports as shown below.
Start Time [16/01/2012][12.00 am]
Can anyone help me regarding that?
Sure it is a multiple step process:
Set up a variable of TEXT as 'DATE' as the variable value and prompt
Set it's 'Default Values' in the left pane to be '1/16/2012'
Set up a variable of TEXT as 'TIME' as the variable value and prompt
Set it's 'Default Values' in the left pane to be '00:00'
Set up a dataset, 'AvailableDateTime' to combine the two into a legitimate datetime field:
SELECT CAST(#Date + ' ' + #Time AS DateTime) AS Datetime
Set up a third variable of DATETIME to be 'DATETIME' as the variable value and prompt.
Set up this variable to use 'AVAILABLE VALUES' on the left pane of properties to be 'Get values from a query'. Use the dataset from step 5.
You now have set up a separate field for data and time.
Further consideration to avoid user input error. You may wish to tie the first variables to be selectable ONLY FROM values you set in available values or from a query. The problem being if a user fat fingers the date or time it will not run as the system is only trying to combine two strings and make a datetime out of it. You may wish to list values directly from a query from the getgo.
EDIT FOR CHANGING FIRST TWO VARIABLES:
You may set the first variable as datetime which gives the end user a calendar.
You can set a second dataset up to get available times for an end user:
declare #time table ( tm int)
declare #cursor int = 0
while #cursor <= 23
Begin
insert into #time values (#cursor)
set #cursor += 1
End
select cast(CAST(tm as varchar) + ':00' as time) as HourOfTheDay
from #time
Setting your second variable to get values from a query that is made in step 2 directly above.
You should now be able to put the values together as above.
As I said in my comment, SSRS does not allow you to have separate parameters for Date and Time.
It has only one parameter Date/Time.
As I see you have two options.
Add a text parameter and consider that as time. You could then do
some validation depending on what tech you are using.
Another way to solve this would be creating a list of possible
values. You select Integer type, for instance and then create a list
of Available Values. (see images)