I need a function that collects the titles from patches and exists and print if there are 2 or more titles that contains one of the $SearchTitles. If I have 2 geo and one Dictionary I want to know about it. If I have 2 Dictionary I want to know. Just one function with 3 inputs (patches,exists.$SearchTitles)
The duplication can be found in patches or in exists or in both
The main goal here is to let the user know if there are more than one title that contains one of the $Searchstring and print the number of the patch.
For an example if 'Dictionary Update' shows in 2 patch's titles I want to print who holds this.
Currently the function combined 2 variables $patches, $exists that holds a list of numbers (I collect them from excel). and for each one of them get the title from the TFS.
I don't know how to search for $Searchstring and get the patches that holds the same title
Need to compare between all the patches only when there is duplicate of Dictionary Update or Geo Location Enrichment
$Searchstring = "Dictionary Update", "Geo Location Enrichment"
$pathesList = #($patches, $exists)
function Duplicatepatches($pathesList) {
foreach ($pathList in $pathesList) {
foreach ($patch in $pathList) {
$Title += (Get-VSTeamWorkItem -Id $patch.Patch).fields.'system.Title'
}
}
$Title
}
$patches =
Patch
-----
1315415
$exists =
Patch
-----
1301707
1292054
1293404
1295392
1298589
1296128
1308438
1310686
Related
Could someone help me out with the code on reading in data in Netlogo? I am trying to choose one element in multiple lists to assign it to the turtle as a variable (I have the data in a rectangular table read from a csv file).
In my current code, it reads as I want but the problem is it is reading only elements of one last row instead of iteratively reading elements (across columns) of all rows. What I need is to read one element of each row at a time.
here are some rows of my data
Here is what I have tried so far:
let residents-file "mock-data.csv"
let residents-list []
set residents-list csv:from-file residents-file
foreach residents-list [ ?1 ->
let hh-col ?1row
let residents-to-create 1
create-residents residents-to-create [ setxy random-xcor random-ycor ]
ask residents [
set shape "person"
set color 9
set ID item 0 hh-col
set occupancy item 1 hh-col]]
It looks like the issue is that you are using create-residents to create n residents, but then asking all residents to do something. In other words, no matter which row is currently being processed, all of the existing residents (whether created in this iteration or created in previous iterations) are being asked to pull the values from the row that is being processed on the current iteration.
The easiest way to fix this is probably just to have each resident pull the values as it's being created.
With this toy version of your dataset:
id occupancy
1 owner
2 renter
3 owner
4 renter
5 owner
Here is a simplified example:
breed [ residents resident ]
residents-own [ id occupancy ]
extensions [csv]
to setup
ca
let residents-file "mock-data.csv"
let residents-list but-first csv:from-file residents-file
foreach residents-list [ cur-row ->
create-residents 1 [
set id item 0 cur-row
set occupancy item 1 cur-row
]
]
ask residents [
print ( word "My who is " who ", my id is " id ", and my occupancy is " occupancy )
]
reset-ticks
end
Output should look something like:
**I have a list called ( a) which holds booleans values thus I want to implement an if statement if each item value in the list ( a )is true and implement another if statement if each item value in list ( a) is false.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I tried this but it does not work !!!
1- foreach a [ x -> if ( x = true) [ask pharmacists [ do the first if statment ]
2- foreach a [ x -> if ( x = false) [ask pharmacists [ do the second if statment ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I want to cycle at each boolean value in list (a) and perform an if statement based on whether the value is true or false.**
I'm not sure I fully understand what you're trying to do- you may want to have a look at the Asking Help for some guidelines. Note the comment:
DO NOT post images of code, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text.
Also, have a look at the section on making a Minimal, Complete, and Verifiable Example. This will help users provide you with a useful answer that is definitely applicable to your issue. If my answer below is not helpful, I suggest you make a toy model that acts as a working example of the problem you're running into.
If you just want to iterate over a list of true / false values, I think you're on the right track- have a look at the very simple example below which just prints a statement depending on whether the current iterated value is true or false:
to setup
ca
let boolean-list [ true true true false true false false false ]
foreach boolean-list [
i ->
ifelse i [
print "Current item is true!"
] [
print "Current item is false!"
]
]
reset-ticks
end
I am trying to create a receipt form where people will confirm if they've received the full quantity of an order. As part of this, I want the following to happen:
If they received the full quantity, a green check mark appears
If they received a partial quantity, an orange triangle appears
If they received no items, a red x appears
To accomplish this, I'm using a continuous form with 3 image files for each situation. I'm using the code below to change the image when the quantity is changed. The problem is, when the quantity is change on 1 line, the symbol changes for all lines. I'll post pictures as well.
Any thoughts on how I can fix this?
I'm open to other methods of accomplishing this idea too.
Private Sub FinalQTY_AfterUpdate()
If IsNull(Me.FinalQty) Then
MsgBox "You must enter a quantity for this item"
Me.FinalQty.SetFocus
Exit Sub
Else
LValue = Me.[FinalQty]
If IsNumeric(LValue) = 0 Then
Me.FinalQty = ""
MsgBox "Qty must be a numeric value"
Me.QTY.SetFocus
Exit Sub
End If
End If
Me.FinalTotalPrice = Me.FinalPrice * Me.FinalQty
If Me.FinalQty = 0 Then
Me.Yes.Visible = False
Me.Change.Visible = False
Me.No.Visible = True
End If
If Me.FinalQty < Me.QTY Then
Me.Yes.Visible = False
Me.Change.Visible = True
Me.No.Visible = False
End If
If Me.FinalQty = Me.QTY Then
Me.Yes.Visible = True
Me.Change.Visible = False
Me.No.Visible = False
End If
End Sub
This is before I adjust the quantity:
This is after I adjust the qty of only the second line:
Since the formatting of each record displayed by a continuous form is inherited from the form design template, any changes to the template will be automatically applied to all records displayed by the form, aside from Conditional Formatting rules in effect or the handful of properties which may changed via the OnPaint event of the Detail section.
One possible alternative might be to add a new field to your table with a data type of OLE Object and populate the value on the AfterUpdate event using the AppendChunk method, sourcing image data from a separate table containing three records corresponding to your green tick, orange triangle, and red cross images.
how can I get the value of a given netlogo patches-own. I can only get the patches-own names (with .word.program.patchesOwn()) but I don't know how to get their values.
thanks
You want the values from all of the patches, or the value from a particular patch, or what?
I'll suppose you want the value from a particular patch.
Assuming, to begin with:
import org.nlogo.headless.HeadlessWorkspace;
HeadlessWorkspace workspace = HeadlessWorkspace.newInstance();
workspace.open("models/Sample Models/Biology/Ants.nlogo");
workspace.command("setup");
Then you don't need anything other than HeadlessWorkspace.report to retrieve a value from a patch, so e.g.:
double food = ((Double) workspace.report("[food] of patch -17 -19")).doubleValue();
Another, more cumbersome solution path involves accessing engine data structures directly:
Patch p = workspace.world().getPatchAt(-17, -19);
int foodIndex = workspace.world().program().patchesOwn().indexOf("FOOD");
double food = ((Double) p.getPatchVariable(foodIndex)).doubleValue();
I have a table in Filemaker 11 which has fields: thingID, infoNumber (#), itemHistory. infoNumber displays the order in which we think the item history's happened (sometimes this is incorrect and needs to be rearranged).
thingID, #, itemHistory
Thing 1, 1, was with Adam
Thing 1, 2, was with Claire
Thing 1, 3, was with Ben
Thing 1, 4, was with Dave
I display these in a List View (ordered by infoNumber asc), and a user realises that it actually went "1,3,2,4", I want to have up and down arrows visible in order for users to switch them, i.e. clicking on the up arrow on the record with infoNumber=3 will set it to 2 and the old infoNumber=2 will be set as 3.
How can I write a script to switch these when the user clicks on a button in a list view?
My idea:
Set Variable[$clickedDown, infoNumber] #the record we click on's infoNumber
If [ $clickedDown != 1 ]
Set Field [ infoNumber, clickedDown -1 ]
# But how do I move to the record with infoNumber = clickedDown-1 ??
End If
The way I have done this, is to do several Finds, here is my solution for going one way.
# First you've clicked on something, record its current infoNumber
Set Variable [ $infoNumber, infoNumber ]
# Use -2 (arbitrary) as a temporary place holder
Set Field [ infoNumber = -2]
Error Capture [ On ]
Perform Find [ thingID = $thingID, infoNumber = $infoNumber - 1 ]
If [ Get (LastError = 401) ]
# No results then just re-search temporary and set it back to what it
was
Perform Find [ thingID = $thingID, infoNumber = -2 ]
Set Field [ infoNumber, $infoNumber ]
Else
Set Field [ infoNumber, $infoNumber ]
Perform Find [ thingID = $thingID, infoNumber = -2 ]
Set Field [ infoNumber, $infoNumber -1 ]
End If
# Go back to layout you were in before
I would be interested to know if there was a better way!
You could do this by using relationships. Create a new table occurrence (say, History Previous) and link it to the list layout's table occurrence (say, History) with the following predicates:
History::ThingID = History Previous::ThingID
History::infoNumber > History Previous::infoNumber
Sort the relationship by History Previous::infoNumber, descending.
This will provide you with a set of related History records that appear earlier in the list for the relevant Thing. The first record will be the immediately previous one, thanks to the sorting.
Now, when you run the script, you can:
If [ Count ( History Previous::ThingID ) > 0 ]
Set Variable [ $infoNumber, History Previous::infoNumber ]
Set Field [ History Previous::infoNumber, History::infoNumber ]
Set Field [ History::infoNumber, $infoNumber ]
End If
Note that, although the History Previous relationship may refer to multiple records, you can rely on the relationship sorting to provide you with access to the first record, both when getting data from it (in the Set Variable step) and setting data into it (in the first Set Field step).