NetLogo, How do I save to file and load from file data entered into an extraWidget menu? - netlogo

Like the title said I'm trying to figure out how to save to file and load from file data entered into the extraWidget menu? I'd appreciate any assistance.

I'll assume that by "data entered into the eXtraWidget menu", you mean the values entered in the widgets appearing on an eXtraWidget tab.
If that's the case, it's fairly easy to do using the xw:export and xw:import primitives.
Suppose you have a very simple xw interface, like this:
extensions [ xw ]
to startup
xw:clear-all
xw:create-tab "t" [ xw:set-title "Menu" ]
xw:create-multi-chooser "mc" [
xw:set-items ["a" "b" "c" "d"]
]
end
That would give you an extra tab like this, with a "multi-chooser" in which you can select multiple letters ("a" and "c" in this example):
To export the whole interface and its content to a JSON file, you can simply call:
xw:export "menu.json"
and then recover the widgets and their values at any time with:
xw:clear-all
xw:import "menu.json"
You need to call xw:clear-all because xw:import will otherwise warn you that those widgets already exists.

Related

outline for a custom document format

The same way HTML and JSON (but not YAML?) already have their navigable Outline, I would like to add the same ability for my custom format, to help me navigate thru lengthy text.
Where I can find documentation for doing so?
I have found "how to add a grammar for highlighting" which is partially useful, (https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide), but not sure following this guide will provide me an Outline, again, YAML for ex. is highlighted, but doesn't appear in Outline.
Admittedly, I haven't read the entirety of the above link, but the word "Outline" doesn't appear, and I have trouble to filter search engine results.
Example below:
{
"doc1": {
"key": 12,
"a": [
1,
2,
3
]
}
}

Can you use nested Repeating Content Controls with the Populate a Microsoft Word template action?

Basically what I am trying to accomplish is to have a table which has a section for each Division and within that section have subsections for each Company within that Division. This is as close as I have gotten (with DivisionTable and CompanyTable both being repeating content controls):
After populating the template from a workflow the Divisions are working fine (its repeating three times w/ the correct info) but in the Company Table it just shows [obj] where it should be the Company Name. It also looks like there may be two new unnamed tags placed here after its generated but I'm not sure.
In the Populate a Word Template action inside the DivsionTable tag I am putting an array:
This is what the first object in the array looks like:
{
"CompanyTable": [
{
"CompanyName": "Company Name Goes Here"
}
],
"DivisionDesc": "Finishes",
"DivisionNo": "09"
}
Is what I am trying to do even possible? I looked at some other posts but I never saw a clear answer.
If it is possible then what exactly am I doing wrong? If it is not possible do you have any suggestions on how to accomplish this another way?

How do I add a hidden string to a google label graph for uniqueness?

I'm using https://developers.google.com/chart/interactive/docs/gallery/treemap to make a sort of heat map of an organization. The labels need to be first name last name... even if 2 people have the same name (don't as me why).
Problem: It seems like the google code needs the block labels to be unique, and all characters are visible ~ so I can't hide something unique in the label.
Has anyone run up against this puzzle?
Ideally I could label things like this <span style="display:none;">uniqueness</span>Joe Dohn
#WhiteHat's comment yesterday lead to the solution. I'll post it here because the solution they pointed out is not well related to the question as it is posted. More like a small side detail included in the Q&A.
The treemap js takes json from the server and shows blocks with labels. The label is also the unique-id linking the parent block to the child datas. That json looks like this...
[
["TARGET", "PARENT", "SIZE", "COLOR"],
["Top", null, 0, 0],
["105::Vincent Tong", "Top", 276969, -67],
["106::David Chung", "Top", 0, 0],
["107::Beatrice Tao", "Top", 0, 0]
...
["8848::Michael Kim", "105::Vincent Tong", 276969, -67],
["7632::Del Rosario, Romelli & Rosemarie", "109::John Villamin", 290000, -67],
["5940::YUNNA WANG", "178::William Yu", 819000, -67]
...
]
Here you can see that Mr. Vincent Tong is identified as 105::Vincent Tong and that Vincent is the parent block of Michael Kim in the second block. The prefix '105::' is used to create uniqueness, but also shows up in the ui as the block label. To create a nice looking label but maintain uniquness we need an object instead of 123::FirstName LastName. The json should look like this:
...
[{"v": "105::Vincent Tong","f": "Vincent Tong"}, "Top", 276969, -67],
...
In the second level, when Vincent is the parent, we keep the unique string but expand Michael to an object.
...
[{"v": "8848::Michael Kim","f": "Michael Kim"}, "105::Vincent Tong", 276969, -67]
...
BUG: I've used this on tree and sankey visualizations. On tree the "f" value is the display label and the "v" is the hidden uniquness. On sankey it's the opposite.

How to make drop-down values to be easily authorable content in CQ

I was trying to understand how can we make drop-down values in dialog box easily authorable?
Select lists in dialogs can load their options dynamically from anywhere, so long as they are provided as an array of values in JSON format (from the docs):
[
{
value: "pink",
text: "Pink",
qtip: "Real Pink"
}
]
So one solution would be to:
Create a new template that would allow an editor to add/remove values from a list — make this editable for content authors as per any other content (e.g. using the page properties, or components that you can drag onto that template).
Create a Servlet that will parse those values & output them in the expected JSON.
Register that servlet, e.g. via a path (/bin/selectvalues).
Using the cqinclude xtype to load in your values:
i.e.
<select
type="select"
xtype="selection"
options="/bin/selectvalues"/>
If you are looking for a drop-in solution for this, take a look at http://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists.html. This supports easily authorable lists of name/value pairs which can be used (without writing additional code) in:
Classic UI Dialogs
Touch UI Dialogs
Touch UI Asset Metadata Editor

filemaker pro 7 email entry form for trade shows data collection

I have Filemaker pro 7 (yes a million years old)
I need help to make a very simple email data collection form for trade shows I attend. Lots of people need this kind of form.
I have done it! It has a space to type your email and then if you CLICK the onscreen “Submit” button it opens up a new record so the next person can enter their email. Simple and sweet.
Yet, what I really want to do is make it that when they hit the keyboard “ENTER” key it opens a new record. So the customer doesn’t have to use the mouse. Why? Because everyone hits the keyboard Enter key automatically. That is what is intuitive. This would make me very very happy!
To really make me ecstatic I would love it if they could type their email once, hit enter and then go to ANOTHER fill-in box on the same page where they would type their email again - to make sure that they spelled it correctly. If the two boxes didn’t match, the program would ask them to try again. If the two entries matched, then when they hit the keyboard Enter key it would open a new record (like above).
Can anyone help me do this?
That could be difficult in FileMaker 7. If you consider upgrading to version 11 or 12 it would be much easier. In the later versions you have a feature called ScriptTriggers that would be very useful for your solution.
The only real way I can think of is if you write a script with a Custom Dialog that shows two fields, one for the email and the other for re-typing the email. You then put this dialog in a loop so it keeps asking for a new email until you click "cancel"
You will need two global textfields for this, globalText1 and globalText2
The script could look something like this.
[Set Field globalText1; ""]
[Set Field globalText1; ""]
[Loop]
[Show Custom Dialog; "Enter new Email"; globalText1; globalText2]
[If get(lastMessageChoice) = 2]
[Exit loop if: True]
[Else if globalText1 <> globalText2]
[Show custom dialog; "You must type the same E-mail in both fields"]
[Else]
[Create new Record]
[Set field "Emailadress"; globalText1]
[Commit record; Do not display dialog]
[Set Field globalText1; ""]
[Set Field globalText1; ""]
[End if]
[End Loop]
Note that the dialog with the two input fields needs two buttons. Button 1 is "OK" and button 2 is "Cancel". The second dialog is only a warning and needs 1 button that is "OK" and no inputfields.
Hope this helps
You can do as Kalle recommended but you won't need to use the Dialog Box.
Put the two fields on a layout and go to that layout before entering the loop.
Replace the Dialog Box with a Pause script step. Set the fields.
Set the fields to tab out when the user presses Enter or Return.
You may find that using a layout is more desirable if and when you move to FMP12.