TFS Build Definition Label Format - vbscript

I'm trying to add some logic to one of our TFS build definition's build label field.
Currently the settings look like this:
Note the custom fields Major Version Number and Previous Major Release Date. I want to modify the Build Number Format field so that the end result will be something like:
<BuildDefinitionName> <Major Version Number>.<# Days since Previous Major Release Date [4 Digits]>.<Revision Number>
so an example output would be:
DebugBuild 6.0.0012.1
Where 0012 would mean 12 days.
How can I accomplish this? I'm having trouble understanding where these $(Var) fields are declared as they seem to be separate from the Build process template variables and arguments while the Major Version Number and Previous Major Release Date arguments I've declared do exist in the build process template and are assigned to arguments MajorVersionNumber and PreviousMajorReleaseDate.

What I have done is customise the TFS build workflow and add a custom Code Activity before the "Update Build Number" step.
This code activity takes in the BuildNumberFormat variable, replaces any of my custom tokens and passes out a result to my own localBuildNumberFormat variable. I then pass my localBuildNumberFormat to the "Update Build Number" activity.
So the process is something like:
BuildNumberFormat = $(CustomToken)_$(BuildDefinitionName)_$(Rev:.r)
Input to Custom Activity = $(CustomToken)_$(BuildDefinitionName)_$(Rev:.r)
Output from Custom Activity = DavesBuild_$(BuildDefinitionName)_$(Rev:.r)
Input to TFS Build Activity = DavesBuild_$(BuildDefinitionName)_$(Rev:.r)
You are essentially replacing all the tokens TFS cannot understand before passing it to TFS.
How you get the values for your Custom Token is up to you, you can pass them as arguments from the build definition/request, or look them up in the Code Activity (I do both in mine).

Related

ODI KM Option - value from FLEX FIELD

Do you think that it's possible to take a value into an ODI IKM Option (for example) from a flexfield?
Example:
You define a flex field on the target table and then pass the value in the IKM.
Then, reading the variable, it's possible to pass it to an option from the IKM?
Thanks,
After searching I found that it's not possible to do it. Conditional Expression can take predefined values. You can find in the next all the combinations:
Condition Expression – It allows you to set the required condition for
the selected option. Double-click the field for editing the condition
expression for the selected option. Click the browse icon Browse icon,
to launch the Edit Expression Editor, which enables you to create or
edit the existing groovy script that determines whether a knowledge
module should be enabled, disabled, displayed or hidden.
Examples are:
return
options.getValue("Cache").equals("true")?"show=true,enable=true":"show=false,enable=false";
This looks at the value of another KM Option called "Cache". If its
value is "false," then the KM Option is hidden, because it's not
relevant.
return
(isStreaming)?"show=false,enable=false":"show=true,enable=true";
This looks at the Mapping isStreaming property. If it's true, then
this option is hidden.
source
It is very easy to do.
You may use odiRef.getTable(java.lang.String pProperty) in the code of your IKM. One of possible values for pProperty is the code of your FlexField.
If you like to pass if through the option just pas <?…?>-substitution as a value of the option. (Probable you should play with %- or ?-substitutions, which is working.)
Refer to «Substitution API Reference» on Oracle site. Many functions like getTable, getIndex, getAK, getContext and others can obtain flexField value of an object of the corresponding type.
Additionally there is the odiRef.getFlexFieldValue() method. It gets the value of any object of any type, but it is required to pass internal IDs as an argument. So it is not convenient.

how to group observations in stata

I'm a beginner with stata so this question might be easy for some of you.
I have a Dataset with Firmspecific data. One variable is Branche which contains the following lines of business: Consumer, Utilities, Food/Beverage, Technology, Logistics/Transportation, Retail, Insurance etc.
Now I want to form groups, for example the group Consumer which should contain Retail, Food/Beverages, Consumer but with the command generate Consumer = Consumer Retail Food/Beverages it doesn't work. Does anyone know what the right command would be? Thanks!
You can use user-written string recode command strrec:
ssc install strrec
strrec Branche ("Consumer" "Retail" "Food/Beverage" = 1 "Consumer"), gen(trunk)
You will need to add additional categories as you see fit. This creates a new variable, trunk, that has labeled integer(s).
You can refer to particular trunks like this:
list if trunk == 1
list if trunk == "Consumer":trunk
The reason I used an integer with value labels rather than a string is that some of the panel data commands do not like string IDs. I am guessing you are headed that route.

Summing XML Data in MSWord Mail Merge

I have a report card written in Word that uses an XML file for its input. In the XML file, if a student remains in the same section all three trimesters there will be one node for that class; if they change sections at the trimester they'll have one node for each section. The nodes look something like this (greatly simplified):
<ReportCardSectionFB Abs1="2" Abs2="11" CourseID="ELMATH1" CourseTitle="Math" PeriodStart="3" TeacherName="Jones, Jennifer" TermCode="Year" SectionID="ELMATH1-4" />
<ReportCardSectionFB Abs1="1.50" Abs2="6" CourseID="ELMATH1" CourseTitle="Math" PeriodStart="3" TeacherName="Smith, Tina" TermCode="Year" SectionID="ELMATH1-3" />
There is no indicator within the XML as to which trimester the node belongs to.
In the Word document, we're pulling the absence data with the following mail merge command:
{MERGEFIELD "ReportCardSectionFB[#PeriodStart='3']/ #Abs1" \# 0.# \* MERGEFORMAT }
That's not working in this situation: it only gets the absence data from the first node it comes across, i.e.: 2.0. Is there a way to get the sum of #Abs1 for all period 3 classes, i.e.: 3.5? If not, is there a way to only get the last #Abs1 for period 3, i.e.: 1.5?
I recommend you to use this 3rd party product, which can use xml as input and is capable of merging it with MS Word template. I is also much more powerful than the built-in Word's mail merge. You can see some examples here.
You could also try summing the absences in Synergy - there's a new checkbox under AttDef1, 2, etc. that adds up all the absences for the data range - Include all day data for the entire date range regardless of section enrollment or section timeframe. That way the absences should be the same for each section, if that works for your district.
You can also try the SET function in Word to nest the MERGEFIELDS as bookmarks and use the Word operator functions to then add the bookmarks.

Getting multiple Configuration Values into a Command Line script

Using TeamCity 9.1.4.
I'm trying to get some server hostnames into a Command Line script with Configuration Parameters. I want each option to contain multiple hostnames.
My configuration:
vanmain => rad-ecr1,rad-ecr2,rad-ecr3,rad-myecr,rad-balancer
tor => rad2-bal,rad2-ecr1,rad2-ecr2,rad2-myecr
fvcdc => rad-fvcdc,rad-balancer
bccfa => rad-bccfa
When I select fvcdc in a build, I receive the following error message:
One of entered values 'rad-fvcdc' is not one of valid select item values: rad-ecr1,rad-ecr2,rad-ecr3,rad-myecr,rad-balancer,rad2-bal,rad2-ecr1,rad2-ecr2,rad2-myecr,rad-fvcdc,rad-balancer,rad-bccfa
How do I get the values into my script?
Dunkan,
I successfully reproduced your issue and was able to find out the root cause of it.
On my virtual installation I created a build with select type parameter, let's name it HostValue. Next, in Items field I copy/pasted values from your initial post and tried to reproduce the problem -- but executing the build was successful. Then I decided to reconfigure parameter and toggled Allow multiple checkbox, and viola, same error message as you got!
If you read small text below Value separator field, you will see, that default value is comma: , and as your values contain this symbol you got an error.
So, to solve this problem I can suggest you these variants:
If you don't need multiple choices, you can just turn off this feature and everything should work.
Replace default Value separator with custom one, for example <SEP>. Then whenever you will select multiple values for this parameter you will get something like:
"rad-ecr1,rad-ecr2,rad-ecr3,rad-myecr,rad-balancer"<SEP>"rad2-bal,rad2-ecr1,rad2-ecr2,rad2-myecr"<SEP>"rad-fvcdc,rad-balancer"
Replace comma in your values with some other separator, for example | or :. In this case it would look like:
"rad-ecr1:rad-ecr2:rad-ecr3:rad-myecr:rad-balancer","rad-fvcdc:rad-balancer"
After that you can use the value of this parameter as usual %HostValue% and parse depending on which variant you choose.
Maybe the error message from server could be a little bit clearer. Hope it will help you.
Also I would like to recommend you my plugin teamcity-web-parameters. It will allow you to create dynamic select values from external web service.
Take a look at this thread: https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206843785-How-to-specify-empty-value-for-Typed-Parameter -- looks very similar to your question.

Pass Crystal parameter from main report to command object

I find lots of info about passing parameter into subreport, but nothing about passing it from main report into command object in main report. (This is the closest I could find.)
The command object received from the vendor (names changed to reduce length) contains
left join LOC L on L.ID = P.Loc_ID
We add parameter "Area" to the main report. {?Area} does what we expect in formulas, but it won't work in a record selection because it can't be matched to anything coming out of the command object. If I replace table LOC in the cited line as
left join **(select * from LOC where A = {?Area})** L on L.ID = P.Loc_ID
then SQL Server complains of "syntax error, permission violation, or other nonspecific error" [sic]
If I create the parameter in the command object editor (even though it already exists outside), then the whole Crystal IDE crashes!
The command object already has parameters that it magically gets from the main report. Must I remove it from the main report (proctalgia) before adding it to the command object? I can't find anything on any menus to link the two parameters together, like I can for a subreport.
Version 2008, if that matters.
If you are using an SQL command, don't create the parameters in the main report. The window where you put your SQL has a section called Parameter List. Create all your parameters relating to the query there and it will be transfered to the main report.
In your coding you have {?Area}, create a parameter with the name Area.
I found a video demonstrating it. It's an old version of Crystal Reports but still works the same.
http://www.youtube.com/watch?v=BHNHsIUbcn8
I found creating the command object and the parameter FIRST is the key. The parameter (say it is InstNo), is then created in the subreport. You can then use "Change SubReport Links" (right click on the subreport), and select that parameter as the parameter to link to. So basically do it backwards, create the command object first, then link it back to the main report. For whatever reason if you do it the other way it does not work (even if the name is the same). Just my experience.

Resources