I have a goto url action in Reporting Services 2008 R2 tablix with the expression:
="mailto:" & ReportItems!Textbox17.Value &
"?subject=" & "Project" & Fields!ReferenceNo.Value & "&body=" & "Hi Guys!,"
The ReportItems!Textbox.17.Value doesn't seem to return the value for the To box in the email.
The ReportItems!Textbox17.Value is an expression of
=Join(
Lookupset(Fields!ReferenceNo.Value,
Fields!ReferenceNo.Value,Fields!Task_Owner.Value, "Alert_TaskOwners"),
";")
Is it possible to return this value for the "To:" field?
The "To" mail field should return such as:
"Name1; Name2; Name2"
it seems that this works by starting the expression with ="mailto://" & ReportItems!Textbox19.Value . . .
the lookup doesn't work but fetching the report item from the tablix with the lookup values in does!
Related
I have a MS Access 2013 memo field that I use to hold text versions of
email. Here is an example:
From: Simon Smith
To: Bob Brown
Date: 5/4/15 2:30PM
Subject: Draft Report
Please find attached the draft report as discussed.
I want to extract the data (i.e. "Draft Report") from the email field "Subject:" from a memo field to a text field on an MS Access form.
Can anyone help?
Thankyou GM
Ok. I have figured it out using Instr and Mid. Thankyou for your suggestion Gord. I'm sure there is better way to do it but it works!
Dim strStart As String
Dim strEnd As String
' figure out where the string starts
strStart = InStr(Me.EmailMemo, "Subject:") + 9
' figure out where the line ends by looking for a carriage return
strEnd = InStr(strStart, Me.EmailMemo, Chr(10))
' display the string
Me.EmailTitle = Mid(Me.EmailMemo, strStart, strEnd - strStart)
In my SCVMM server, the following error is logged in events.
Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99" could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041003. Events cannot be delivered through this filter until the problem is corrected.
How to resolve it?
Try this workaround from Microsoft. It's actually a good one, and comes with a "real" explanation of the problem.
http://support.microsoft.com/kb/2545227 (For Win7 and Server 2008 R2)
http://support.microsoft.com/kb/950375 (For Vista and Server 2008)
In summary, this is a leftover WMI registration from the ISO creation process that can be safely removed.
For Windows 7, make a .vbs file with the following and execute it from an elevated command prompt:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\subscription")
Set obj1 = objWMIService.ExecQuery("select * from __eventfilter where name='BVTFilter' and query='SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA ""Win32_Processor"" AND TargetInstance.LoadPercentage > 99'")
For Each obj1elem in obj1
set obj2set = obj1elem.Associators_("__FilterToConsumerBinding")
set obj3set = obj1elem.References_("__FilterToConsumerBinding")
For each obj2 in obj2set
WScript.echo "Deleting the object"
WScript.echo obj2.GetObjectText_
obj2.Delete_
next
For each obj3 in obj3set
WScript.echo "Deleting the object"
WScript.echo obj3.GetObjectText_
obj3.Delete_
next
WScript.echo "Deleting the object"
WScript.echo obj1elem.GetObjectText_
obj1elem.Delete_
Next
I am quite new in vbs and I would like some of your help on this script.
Basically I need a script that will get my current computername, look into a csv file to get the new related computername and then use that new name to move the corresponding account in the AD to a new OU.
I already know how to get my current computername and how to move an object to a new OU, these are things I have already done, but I am really not confident about parsing the csv looking for the new computername based on my current one.
The new name is the value just after the current name in the csv file. Only separted by a coma.
Edit 1
I tried your solution but as stated in the comments I think there are some things that I don't get. I might misuse the recordset or do not know how to retrieve the information from it. Here is my full script so you can see what I am doing:
'Get the old/current computername
Set wshShell = WScript.CreateObject( "WScript.Shell" )
OldComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
'Parse the xml file to get the related new computername
Dim CONNECTION : Set CONNECTION = CreateObject("ADODB.CONNECTION")
Dim RECORDSET : Set RECORDSET = CreateObject("ADODB.RECORDSET")
CONNECTION.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\;Extended Properties=""text;HDR=YES;FMT=Delimited"""
RECORDSET.Open "SELECT NewComputerName FROM ComputerList.csv WHERE ComputerName = '& OldComputerName'", CONNECTION, 3, 3
'Move the new computername in the target AD to a new OU
Dim NewComputerName
Dim OldLocation
NewComputerName = RECORDSET
OldLocation = "LDAP://CN=" & NewComputerName & ",OU=Staging,OU=Workstations,DC=contoso,DC=lab"
Set objNewOU = GetObject("LDAP://OU=Migration,OU=Workstations,DC=contoso,DC=lab")
Set objMoveComputer = objNewOU.MoveHere(OldLocation, vbNullString)
' It does not work as it said Error: Wrong number of arguments or invalid property assignment pour la ligne:
' OldLocation = "LDAP://CN=" & NewComputerName & ",OU=Staging,OU=Workstations,DC=contoso,DC=lab"
Thanks a lot for your help ! :)
You can use ADO to read CSV (and other delimited) files. The gory details are discussed in this article. Sample code for reading a simple CSV file using VBScript is as follows:
Note: the CSV file needs a header line in order for ADO to use column names:
ComputerName,NewComputerName
Computer #1,Other Computer #1
Computer #2,Other Computer #2
Computer #3,Other Computer #3
VBScript Code:
option explicit
dim CONNECTION : set CONNECTION = CreateObject("ADODB.CONNECTION")
dim RECORDSET : set RECORDSET = CreateObject("ADODB.RECORDSET")
CONNECTION.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Folder\Containing\CSV\File\;Extended Properties=""text;HDR=YES;FMT=Delimited"""
RECORDSET.Open "SELECT * FROM data.csv WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3
' //// For testing \\\\
WScript.Echo RECORDSET.Source
' \\\\ For testing ////
if RECORDSET.EOF then
WScript.Echo "Record not found"
WScript.Quit
else
dim NewComputerName : NewComputerName = RECORDSET("NewComputerName") & ""
WScript.Echo NewComputerName
end if
Note that this code might not work on 64-bit OS -- not directly. You must run 32-bit version of CScript/WScript like so:
%windir%\SysWoW64\cscript c:\Path\To\test.vbs
Ok the script works perfectly now thanks to your modifications ! :)
But I've got one more trouble, it seems that I cannot open the csv file in the FROM clause when this file have - in the name.
Like : CONTOSO-US-ComputerList.csv I get the error Syntax error in FROM clause
But when I use a file name without dashes there is no problem.
I know it is a detail but I have no choice than having a file with dashes in the name :/
Thanks again for your help :) Very much appreciated !!
EDIT:
Nevermind I found the solution thanks to the scriptingguys !
The request now looks like this:
strFile = "[CONTOSO-ComputerList.csv]"
RECORDSET.Open "SELECT * FROM " & strFile & " WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3
I'd like to extend the MS Excel 2010 by adding some more "Additional Cell Actions". (accessible via cell right-click > Additional Cell Actions). Specifically, I'd like Excel to:
recognize five-to-eight digit numbers as Part Numbers with action: "Open URL to technical docs"
recognize string "OR ## #####" (# for digit) as Order Reference with actions: "Open spec file" and "Open material file" (both Excel files located at specified paths in the intranet)
Now, I have no idea how to program this. I suspect that some XML snippet is needed and probably some VB code too. VB code wouldn't be a problem - I have macros doing those functionalities done for Excel 2003 - but I have no idea where to place it.
Please give me some pointers, I've asked Google but can't get the answer, seems that "Additional Actions" is pretty common phrase :)
This can be achieved by adding a right click event handler to the workbook
In the Workbook module add this code
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Dim cBut As CommandBarButton
Dim v As Variant
On Error Resume Next
v = Target
' Remove any previously added menu items
Application.CommandBars("Cell").Controls("Open URL to technical docs").Delete
Application.CommandBars("Cell").Controls("Open material file").Delete
' save cell value for use by called macro
CellValue = v
' If cell matches criteria add menu item and set macro to call on click
If IsNumeric(v) Then
If v >= 10000 And v <= 99999999 Then
Set cBut = Application.CommandBars("Cell").Controls.Add(Temporary:=True)
With cBut
.Caption = "Open URL to technical docs"
.Style = msoButtonCaption
.OnAction = "OpenRef"
End With
End If
ElseIf v Like "OR ## #####" Then
Set cBut = Application.CommandBars("Cell").Controls.Add(Temporary:=True)
With cBut
.Caption = "Open material file"
.Style = msoButtonCaption
.OnAction = "OpenMat"
End With
End If
End Sub
In a standard module add this code
Public CellValue As Variant
' replace MsgBox code with your logic to open files
Sub OpenRef()
MsgBox "Open Reference Doc code here for " & CellValue
End Sub
Sub OpenMat()
MsgBox "Open Material File code here for " & CellValue
End Sub
i have a link in my app with the following URL:
http://www.mysite.com/test?group=MyGroup
the issue is one of the groups is called Group A & B
when i try this and parse it on the serverside (through Request.QueryString["Group"])
http://www.mysite.com/test?group=Group A & B
i get
group='Group A ' (because of the &)
how can i change my URL so it can deal with values with "&" inside of them.
Use the URLEncode method to make your text safe for a querystring.
var url = "http://www.mysite.com/test?group=" +
System.Web.HttpServerUtility.UrlEncode("Group A & B");