I am new to filemaker and have been using it since 2 weeks. Is there any way by which we can create a url for a specific record located in a particular layout so that when we fire up that url only that record appears on web. Any help will be much appreciated.
Not directly. This feature was removed in later versions for security reasons. You can however pass a script name and parameter which would enable you to script the process and go to the layout/record you want.
http://<host>/fmi/webd/<database name>[?script=<script name>[¶m=<script parameter>][&<$variable name>=<value>]]
More on this in the WebDirect guide.
Edit:
The URL:
http://<host>/fmi/webd/Database?script=WD_GoToReCord¶m=xxxx
Where xxxx is the record ID of the relevant record.
The FileMaker script:
Name: WD_GoToReCord
# Performs a record search and goes to layout for display
# Requires a field in the database that is unique per record.
# The example uses a calculation field named RecordID with the calculation Get(RecordID)
Set Variable [ $recordID ; Value: Get(ScriptParameter) ]
If [ IsEmpty ( $recordID ) ]
Exit Script [ Text Result: ]
End If
Set Error Capture [ On ]
Go to Layout [ “Record Search” ; Animation: None ]
Enter Find Mode [ Pause: Off ]
Set Field [ Database::RecordID ; $recordID ]
Perform Find []
If [ Get(FoundCount) = 1 ]
Go to Layout [ “Switchboard” ; Animation: None ]
Else
# show some error or ignore
End If
Related
This is currently what I am struggling with. I am new to netlogo so any help is nice. This is a modification on the 'virus' tutorial.
ifelse-value
choice = 0 [ go-quarantine ]
choice = 1 [ wear-mask ]
[ get-sick ] ) ]
Brandon, and welcome! Yeah the documentation is a little fuzzy on this.
I think you want just "ifelse", to branch to some action, not "ifelse-value" which returns a value.
you need a "(" before "ifelse" or it won't work. You have the closing ")".
you do not need a closing "]"
"choice" is not a necessary magic word. You can use any logical test.
So the command you're looking for would be this pattern, where white space is flexible in NetLogo and "..." means zero or more things may go there. I'm old-school and prefer to put parentheses around conditional tests but you don't need to.
(ifelse
( test-1 ) [ actions 1 ...]
( test-2 ) [ actions 2 ...]
...
( test-n ) [ actions n ...]
;; else
[ default actions ]
)
So say this person has 33.3% chance of going each of those ways.
you could code an instance of this pattern as follows:
let mood random 3 ;; returns integer values of 0, 1, or 2
( ifelse
( mood = 0 ) [ go-quarantine]
( mood = 1 ) [ wear-mask ]
[ get-sick ]
)
where implicitly that code would expect those actions to be defined later:
to go-quarantine [ do this ] end
to wear-mask [ do that] end
to get-sick [ do other stuff ] end
And the choices of values of 0, 1, 2 etc. and having them in that order is not required.
**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
Greeting,
let assume, I have one manufacture and 10 customers that manufacture create links with some of them randomly(I call these links "contract-links").
One of the properties of manufacture is "real-cost" and one of the properties of customers is "real-waiting-time". "real-waiting-time" is a clear number. Also, Assume service-cost as a global variable.
To calculate the "real-cost", I need the sum of "real-waiting-time" of customers who have links with the manufacture and then multiply in service cost.
I have a question here to calculate "real-cost". How can I call the "real-waiting-time" of all customers and then calculate the real-cost for manufacture?
manufactures-own [ final-costs]
customers-costs [ real-waiting-time]
contract-links [ the-real]
ask manufactures [
final-calculation-for-manufacture
]
to final-calculation-for-manufacture
let the-manufacture self
let the-contract my-contract-links
ask my-contract-links [
set the-real [real-waiting-time] of end2
]
let the-sum sum [ the-real] of my-contract-links
set final-cost the-sum * cost-service-slider
end
It gives me a number, but the answer is wrong.
I think the reason that you are getting the wrong number is that you are doing a lot of setting of the attribute values at the other end of the links instead of getting the information from that link. But your general approach is too complicated - if you have created a link breed called contract-links (which you seem to have), then the agents at the other ends of those links are the link neighbors of agent asking. Try something like this.
manufactures-own [ final-costs]
customers-costs [ real-waiting-time]
contract-links [ the-real]
ask manufactures
[ let the-sum final-costs sum [real-waiting-time] of contract-links-neighbors
set final-cost the-sum * cost-service-slider
]
end
This assumes you want the sum of the waiting times of the linked customers. I couldn't work out what the attribute the-real is for the links.
My first netlogo program was working well, but now is failing since 'tick' in the 'go' method is not in a valid context.
Please see the attached code, line 99, which generates:
You can't use tick in a turtle/patch context, because it is observer only.
Code is here:
http://jpark.us/temp/CSSS.v1.nlogo
Problem solved...
I was trying to 'set number.sparrows...' down in other methods, but not within a proper patches context.
So this works:
if all? patches [ eggs.laid = true ] [
ask patches [ set number.sparrows count sparrows-here ]
whereas this does not:
if all? patches [ eggs.laid = true ] [
set number.sparrows count sparrows-here
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).