MS Project - VBA - Changing resource type - vba

Sorry if the question has been answered but I looked a bit on the site and it has helped in many ways already !
I was asked to do in VBA some programming to transfer data into MS Project.
I managed to do it all except for one thing, when I create a resource, Project automatically describes it as a Work Type and some of mine are actually Material Type.
I then thought of changing it after creating the resource and assign it to a task
My bit of problematic code is the following
Set NR = .Resources.Add(name:=tmpTxt)
.Resources(k).Type = pjResourceTypeMaterial
.Resources(k).Assignments.Add TaskID:=j
When I run it I don't have any error message, but in the resource view on MS Project the Type hasn't changed...
I would be very grateful if any of you can help me !

Is there some code you haven't included in your extract that associates NR with .Resources(k)? It looks like you have created a new material resource and tried to set the resource type of some other existing resource to "Material". Can you please include the with . . . end with construct?
Without seeing more of the problem I'm not completely sure what you are having trouble with but assuming you are referencing the ActiveProject all you need to do to create a new Material type resource is:
Set NR = Activeproject.Resources.Add (name := "A New Resource")
NR.Type = pjResourceTypeMaterial

Related

Create a folder about an item with Microsoft Graph Sharepoint

How do I create a folder on my list? I can create a file but I can't define a type.
Should I define a type column? But how can I create a column with a type characteristic?
I am using Graph Explorer to build and want to use PHP after for my Laravel website.
Thank you for your answers !
After testing and testing, i find my request.
If it can help someone :
POST https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{item-id}/children
site-id is composed about two ID, site-id and subsite-id.
To find your site-id :
GET https://graph.microsoft.com/v1.0/sites/root
My subsite-id is my groupsite id, you can find him on :
GET https://graph.microsoft.com/v1.0/sites/{sites-id}/lists?search=doc
After i did a request to find {item-id} :
GET https://graph.microsoft.com/v1.0/sites/{site-id}/drive/root:/test
And to end :
POST https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{item-id}/children
You can create a new list with a document library as a template. Then you will have a new drive in the root of your site where you can create a folder.

Wrong "ReflectedWorkItemIDFieldName" while migrating Azure DevOps Work Items

I am testing the azure-devops-migration-tools and have create a project using https://azuredevopsdemogenerator.azurewebsites.net/ (Parts Unlimited). I have generated the configuration.json and changed the Source and Target so I can test a migration, but I'm getting errors while migrating Work Items.
[15:14:41 ERR] Error running query
Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF51005: The query references a field that does not exist. The error is caused by «ReflectedWorkItemId».
I've tried different options on the "ReflectedWorkItemIDFieldName" field, Scrum, Basic, Agile, Custom, empty but am still unable to migrate the work items.
How can I get the value to put on this field for the specific project?
Thanks,
Bruno
Quick Solution: Most ADO instances use the prefix 'custom' for new fields. Try "Custom.ReflectedWorkItemId" in your configuration.json to see if that resolves the problem.
More details: It's hard to tell without an actual configuration.JSON file to review. One possible problem is that you need to use the actual and full internal 'Name' of the ReflectedWorkItemID field. This doesn't show in ADO, or the Process Template when created. The recommendation is that you create a query referencing your custom field, and export the WIQL file (query file). Once you export the WIQL file, you can then open the file and see the full syntax of the custom field.
Exporting Queries: If you don't know how to do this, it can be done with VisualStudio. If you don't know how to do that, you can install this extension. It's a handy WIQL import/Export and editor. Install, and your ADO Queries with have an Edit in WIQL Editor option. Create a query that exposes your 'ReflectedWorkItemID' as a column, then edit that query in the WIQL editor and see the full names of the Reflected Work Items ID Feild. https://marketplace.visualstudio.com/items?itemName=ottostreifel.wiql-editor
SELECT
[System.Id],
[System.WorkItemType],
[System.Title],
[System.AssignedTo],
[System.ChangedBy],
[Custom.ReflectedWorkItemId]
FROM workitems
WHERE ...
I found a possible solution. I have created a custom process, change the process from the projects to this new one and add a new field. This is the field I'm using on the configuration.json and now I'm able to migrate work items
To make the migration in the "ReflectedWorkItemIDFieldName" you must do:
"Organization Settings" -> Process -> Select the process where you project are (Basic, Scrum, Agil, or CMMI).
then click on the 3 dots and create a new Inherited process.
Then with the inherited process, you are able to create a new field for each work item type. The name that you type (could be "IronMan") that name will be in your configuration file.

PhpStorm unable to resolve column for multiple database connections

I have only been using PhpStorm a week or so, so far all my SQL queries have been working fine with no errors after setting up the database connection. This current code actually uses a second database (one is for users the other for the specific product) so I added that connection in the database tab too but its still giving me a 'unable to resolve column' warning.
Is there a way to see what database its looking at? Will it work with multiple databases? Or have I done something else wrong?
Error below:
$this->db->setSQL("SELECT T1.*, trunc(sysdate) - trunc(DATE_CHANGED) EXPIRES FROM " . $this->tableName . " T1 WHERE lower(" . $this->primaryKey . ")=lower(:id)")
Also here is what my database settings window looks like as seen some people having problems with parameter patterns causing this error but I'm fairly sure that is not the issue here:
Using PhpStorm 10.0.3
You can set the SQL resolution scope in File -> Settings -> Languages & Frameworks -> SQL Resolution Scopes.
This allows you to provide a default for the entire project and you can optionally define specific mappings to certain paths in the project.
So the short answer is that it cant read the table name as a variable even though its set in a variable above. I thought PhpStorm could work that out. The only way to remove the error would be to either completely turn off SQL inspections (obviously not ideal as I use it throughout my project) or to temporarily disable it for this statement only using the doc comment:
/** #noinspection SqlResolve */
Was hoping to find a more focused comment much like the #var or #method ones to help tell Phpstorm what the table should be so it could still inspect the rest of the statement. Something like:
/** #var $this->tableName TABLE_IM_USING */
Maybe in the future JetBrains will add that or make PhpStorm clever enough to look at the variable 3 lines above.
You can use Nowdoc/Heredoc also instead of using
/** #noinspection SqlResolve */
Here is the example
$name = "your name";
$query = <<<SQL
SELECT * FROM user WHERE name LIKE "%$name%" ORDER BY id
SQL;
Both of the methods will make the warning gone

How can I add new states for a country in OpenERP/Odoo?

I was trying to find the file where the states for US are charged to the data base , but I only found res.country.state.csv file, and I modified adding other record then restart the server, and nothing happened.
If anyone have a tutorial o pdf guide to help me. I would appreciate it very much.
Thanks...
States data are defined in res.country.state.csv file as you mentioned.
You can define a new file like this one or just modify it respecting that format.
To visualize your changes, don't forget to update base module (restarting server not enough).
If you create a new file don't forget to add it to data section in _ _openerp_ _.py

Maximo - Adding elements to a CustomMboSet using scripting

Is it possible to add to a CustomMboSet in Maximo using scripting? I am writing a custom application using a custom object called TIMESHEET. As part of the application I am writing a (Jython) script that needs to dynamically build up an MboSet (a set of TIMESHEETs). The code retrieves an existing CustomMboSet and attempts to add elements to it. It works when using an out of box MboSet, but when I try to run the same code on a custom MboSet it does not seem to work. No error is thrown, but code below the offending line is not run.
In other words, this works (LABTRANS is an out of box MBO):
myMboSet = mbo.getMboSet("LABTRANS")
newMbo = myMboSet.add()
# Set attributes on newMbo, everything is happy
But this does not (TIMESHEET is a custom MBO):
myMboSet = mbo.getMboSet("TIMESHEET")
newMbo = myMboSet.add()
# Code does not execute after the above line
Anyone have any insight as to why I am seeing this behavior? Does the Maximo scripting framework simply not support the dynamic building up of CustomMboSets? Any help is appreciated. Thanks.
You need to make sure that the relationship exists between the Current MBO and the Custom MBO in the database configuration otherwise it will not work.
Alternatively you can use the following code to create an new mboSet on the fly:
timeSheetMboSet = mxServer.getMboSet("TIMESHEET", userInfo)
mbo.getMboSet(RELATIONSHIPNAME).
LABTRANS and TIMESHEET must be the relationship names to the object in auto script.
If you want to get/add records in any object, use
mxServer.getMboSet(OBJECTNAME, userInfo)
A bit more explanation. You can create your own custom relationship from within your automation script. The trick is to make sure it's not already existing. That's why I use a dollar sign for mine.
variable = mbo.getMboSet(tempRelationshipName,Object,where clause)
previousPhaseSet = mbo.getMboSet("$wophasetranstemp1", "exitdate is null")