How to duplicate a population of agents - agent

I have got a population of agents named as customers and a number of variables, parameters, and statecharts are defined for them. Then I created a second population of agents. They should include everything that I defined for customers and a few more. I tried copying everything in the customer graphical view page and pasting them into the new agents' page, but it does not work. How can I do that?
Thank you

I assume you want to actually copy your agent-type, add some more variables... and create a population off that new type, correct?
In that case, you need to copy the actual agent-type in the "Projects" window. Right-click the customers agent-type, then "copy.
Now, right-click on the top-level model-object (named like your model) and right-click it. It will allow you to "paste" now. You will have an agent-type "customers" and "customers1" now.
PS: if you have similar agent types that share properties, you should actually use "inheritance" (a Java core functionality that can be used powerfully in AnyLogic).

Related

Accessing Anylogic Agents not created automatically at the start of the model

With Anylogic Agent based modelling, If you create Population of Agents (for Example MyAgent and myAgents are the type and population respectively) but leave it empty at design time and when the model runs initially, say they are created by use of the inject function. When the model creates them by inject through the logic of the model, the population - myAgents still remain empty. Where is the population of these agents? I know they exist because i can count them and access their properties. How to access a particular member of this group and browse through their properties of each, like you can with existing non empty populations?
Ok, i just realized how to do this. When you add agents by say injecting them and you have "add agents to Default Population" (the default option). It doesnt go to the population "myAgents". I am not sure where it goes (in what population) but if you want it to go to "myAgents" you have to choose "Add agents to:" Custom Population and choose myAgents.

How should I implement `OnLoad` event handler when creating an activity using a contact?

I've created my own solution with a custom entity of type activity. I'd like to show a message whenever a new instance of it is created using an existing contact but not allow the user to create one, if only attempting to do that without going via contact.
Basically, my aim is that it won't be impossible to just create that activity (the form will be hidden directly at any attempt except for one way only). The user will have to go to contacts (or leads etc.) and in there add and create an instance of the custom activity entity. That way, I can assure that the field "regarding" will be filled out already.
I'm guessing that I need to detect somehow that the opening of the form is a creation attempt. How can I do that?
Also, as it is now, the user can't create a contact-less activity of the custom type because it doesn't appear on the menu with other activities. I must have disabled it somehow but I have no idea how. Anybody who has one?
You could do this a bunch of ways but the easiest would probably be to:
Make the regarding field read only.
Make the regarding field mandatory.
That way if a user opens a create new form they wont be able to set the regarding and because its mandatory they wont be able to save the record. When they open via an existing contact the regarding field will be mapped automatically. That said in this case just making it mandatory my be enough.
(As a side JavaScript can be used to identify the current form state, but I'm not sure how useful that is here).
In terms of where custom activities appear, by default mine show in a number of locations, for example:
CRM > Workplace > Activities > Ribbon > Other Activities > XXX.
CRM > Workplace > Activities > View Selector > XXX.
They don't show under the left hand navigation of the workplace because they are grouped under 'Activities'. I'm pretty sure these are all the default settings.
You can exercise greater control by editing the sitemap, where you can put pretty much anything, anywhere.
In addition to Mr Wood, I'd like to show you some code. It works as supposed to but I'm not sure if it's optimal.
var foo = function () {
var whatIsGoingOn = Xrm.Page.ui.getFormType();
if (whatIsGoingOn === 1)
alert("Let there be an entity!");
else
alert("Not a creation...");
}
The other states' (deletion, update etc.) numeric values are listed here.
Answering the second part of your question:
When you create a custom activity you can choose whether to have it appear in 'normal' Activity menus or not by checking the box at the top right of the entity form. This is a once-only choice as far as I know and can't be changed later.
For your setup, I would suggest NOT checking this box, so it does not appear in the activity menus to avoid users even being tempted to do it that way.
Instead, add an explicit relationship to the activity N:1 to Contact, and another N:1 to Lead. Use this relationship to add your activity to the left navigation of Contact and Lead forms, or add a grid for them (depends on how you want to use this and if you need to filter the view to something other than the default "Associated View").
When a user navigates to this section they will see if any previous activities of this type exist, and be able to add a new one. BUT this means that the child record is a child via this relationship, not using "regarding", so use a script on the form for the activity so that if Contact is filled in, it is copied to Regarding, and if Lead is filled in then that is copied. If neither, then use an alert or other means to warn the use that something is wrong (see comment earlier). If you want Regarding to be read-only but filled in by script, you will need to make sure to use the force the value to be saved:
Xrm.Page.getAttribute("regardingobjectid").setSubmitMode("always");
You must have the lookups for Contact and Lead on the form to be able to use them in your scripts, but you can make them not "visible by default" so they are there but not seen by the user (and taking up no space).

Requirement management in Enterprise Architect and Excel

I'm starting a new project and want to do my requirement management with Enterprise Architect.
It look really nice to define requirements, associate use cases, design elements, test and so on, all in one software.
I succeeded in creating a profile that let met drag custom requirement with predefined tagged value for enterprise stuff.
My problem is that the requirements must be manage at 3 level. The team, the management and the client. The management and the client both communicate with Excel.
My question is, it is possible to do something like:
- Create requirements diagram in EA with predefined tag value
- Export requirements in Excel (with predefined tag value) - I haven't been able to export my predefined tagged value.
- Modify the excel file
- Import from excel and update the requirements in EA.
Yes, you can do this using CSV Import/Export.
The ability to include tagged values in CSV import/export was added fairly recently, so make sure you're running an up-to-date EA (at the time of writing, the latest release is 9.3.931).
Assuming you've got all the requirements in a single package, proceed as follows:
Right-click the package in the project browser, select Import / Export -> CSV Import / Export.
Click the Edit / New button in the upper right corner of the dialog that opens.
From the Available Fields list, select GUID, Type, Name, Notes and any other fields you use (eg Difficulty).
Click Add Tagged Value Field -> Value.
If the tag you're after is defined in a properly deployed UML profile, you can find it in the list. Otherwise, click the Other Element button and navigate to one of your requirements; this will allow you to select tags created on-the-fly as well.
Back in the Specification dialog, make sure you've selected the correct delimiter (upper right corner) and set a name for the specification. The other dialog options can be left empty but it's probably a good idea to specify Requirement as the default type. Save the specification and close the dialog (you only have to create the specification once, of course).
In the Import/Export dialog, specify a filename and select Export. Click Run to export the requirements.
To reimport, simply select to Import rather than Export in the CSV Import / Export dialog.
The two crucial fields are the GUID and the Type. You may want to hide these columns when you send the requirements to management and client, and inform them that they shouldn't tamper with those.
The GUID is the unique identifier. As long as that's in the file, EA can reimport the file and update your modelled requirements.
The Type needs to be set to Requirement for any new requirements that are added in the file. You don't need to set a GUID. EA will ask you during the import whether to create one or ignore the entry completely; tell it to create one and the requirement will be added to your model. But the Type field has to be set or EA won't know what to create.
What EA won't do is delete requirements from your model if they've been removed from the file. This is something you'll have to manage manually. (And if you're working on a project where the number of requirements actually decreases over time, please give me a call.)
If your requirements are in several packages you can still import / export them this way, but it's a little bit more complex: you'll need to set the Preserve Hierarchy option in the CSV specification and use a couple of special columns, but that's pretty well described in the help file.

Edit a SharePoint lookup field link from the linked "child" record

I have two lists in SharePoint, one each for projects and tasks, that I need to relate through the use of a lookup field.
If I create the lookup field in the project list then I can assign multiple tasks to the project and easily see what tasks are assigned to the project and click through to the project. I cannot, however, see what project tasks are assigned to in the task views.
If I create the lookup field in the task list, then I can easily choose which project to assign it to and I can sort or filter the task list view by project using the values in the lookup field, but I can't easily see which tasks are assigned to any given project in the project list view.
If I have to choose one or the other, the latter is the better option since the list of projects is shorter than the list of tasks and I can always filter on the project name in the lookup field column in the task list view.
Ideally, however, I would like to easily be able to see which tasks are assigned to a project from within the project list view, and maybe even edit the relationship from there.
Is there any way to do this in SharePoint?
Thanks!
it will work if you keep the 2 lookup but I don't recommend that the other way around is to create a custom listing web part thru SharePoint API and get the tasks related to each projects
So far the following solution seems to be working pretty well and does not involve the use of any new web parts or custom code.
I have the lookup field (with select multiple disabled) in the task list (the child list).
As stated in the question, the lookup list for the projects is much shorter and easier to use than the lookup field for the tasks. This also allows me to go into the tasks list view and filter on the lookup field (which is also a link to the respective project).
To facilitate easy access to the tasks for any given project, I added a link field to the project and link to the list view that is filtered for that particular project's tasks.
This keeps the list structure simple but allows me to quickly jump between the two lists.
Thanks!

SharePoint "Group By" is broken when using "Allow Multiple Values" for a column

I want to show the documents in my document library grouped by category. The category is a lookup column that I added that allows for multiple values. Unfortunately this breaks the "group by"-functionality completely. Is there a programmatic solution to this problem?
There is one way... It's complex and ugly - but it should work :)
It is possible for you to write you own view for at list (HTML, JavaScript and all). The VWSTYLES.xml file in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\GLOBAL\XML folder, contains the HTML and JavaScript for the default SharePoint view styles - getting your inspiration from this, you can create your own view style, where you can do anything you want!
The problem is, that SharePoint don't have any way to deploy your custom view style - this is where the ugly part comes in - you have two options for deploying your view style.
Add you code directly to the VWSTYLE.xml/Edit a copy of it and override it with a feature
Pros:
You will still be able to edit the
view from the SharePoint interface
Cons:
You override a default SharePoint
file - your work can be overridden by
a SharePoint update.
Your view style will be available on every list in SharePoint.
Create your view programmatically on the list
Pros:
You don't override any default
SharePoint files.
You can control which list uses your
view
Cons:
You wont be able to edit the view thru the SharePoint interface
I've used method 2 a couple of times myself - and it works... but it's not pretty! :)
I don't think what you are trying to do is possible. When grouping items/documents, you display them in different groups based on a grouping value. I don't think SharePoint has support for adding a single item to multiple groups. With multiple values in the grouping field its' impossible to know which group to add the item/document to. I am not sure if this is an error or if it's by design.
Thomas is correct, this is by design as the item would have to appear multiple times in different groups. It is worth noting that this is possible via the web services, however.
See why I was getting duplicate rows from the sharepoint lists web service
And no, I've no idea why the lists webservice will do it, but the API won't.
Check out this link as well. Access supports this functionality without having to do much ugly code. http://office.microsoft.com/en-us/access/HA012337221033.aspx
So here is a sort of hack that has worked for me, no guarantees though. While your column (Office in my case) has allow multiple values enabled, fill in all of your data as needed. Once done, go to List Settings, click the Column "Office", and turn off allow multiple values. SharePoint will pop up a warning about how this data may be lost (never happened to me). Hit okay, then modify the view you want grouped, "Office" should now show up on the drop down of columns to group by. Finished result will result in your groups (and or sub groups) showing up just fine.
The only qualm I have is that instead of having an item show up in both Group A B because it had both field A and field B checked in Column X, it just creates a new group, Column X: A; B. So in my case, I have staff in both Beaufort and Orangeburg Offices, instead of having those staff in both groups (preferable) it creates a new group as below:

Resources