It probably sounds simple, but I can not find a way out.
I'm trying to create a more or less dynamic json and I need to convert the content of object to a string between double quotes. Something like that :
""" + object + """ gives the following result "object" and the expected result would be "content of object".
Here is my code, will probably be more clear, about what it's about.
Dim jsTest As String
jsTest = """ + CStr(Msg.Subject) + """ + """ + CStr(Msg.Body) + """
Msg.Subject and Msg.Body are objects from Email. I can do that this way(with single quotes):
Dim smry, descrp, jsTest As String
smry = """summary"""
descrp = """description"""
jsTest = "{" + smry + ":" + "'" + CStr(Msg.Subject) + "'" + "," + descrp + ":" + "'" + CStr(Msg.Body) + "'" + "}"
but then I get content of object as String with single quotes and I cant put it in my JSON like so:
{"summary": 'Release 18.20 Produktion', "description": 'Guten Tag Sie erhalten diese Terminanfrage'}
How can I get result like (Note double quotes):
{"summary": "Release 18.20 Produktion", "description": "Guten Tag Sie erhalten diese Terminanfrage"}
If you replace this:
jsTest = "{" + smry + ":" + "'" + CStr(Msg.Subject) + "'"
with
jsTest = "{" + smry + ":" + """" + CStr(Msg.Subject) + """"
and so on, you will get your quotes.
Related
So I have an expression that does a good job of outputting data on a report. However, I want to be able to sum/combine the fields.
Here is the original expression.
= trim(Fields!Cost_Element_User_Define_1.Value)
+ " " + FormatCurrency(Fields!Billable_Equipment.Value)
+ " " + trim(Fields!Cost_Element_User_Define_2.Value)
+ " " + FormatCurrency(Fields!Billable_Material.Value)
+ " " + trim(Fields!Cost_Element_User_Define_3.Value)
+ " " + FormatCurrency(Fields!Billable_Labor.Value)
What I would like to do is combine group/sum billable_material.value.
How would I go about doing that?
I want to create issues in Jira based on Outlook emails received using VBA.
However, when setting the assignee/reporter via the REST API it appears that users can only be specified by name. When trying to specify a user by email address I get this error:
assignee: expected Object containing a 'name' property
Here is the Json code that is not working:
JSON(0) = "{"
JSON(1) = " ""fields"": {"
JSON(2) = " ""project"": {"
JSON(3) = " ""id"": 23354"
JSON(4) = " },"
JSON(5) = " ""summary"": ""#customSubject"","
JSON(6) = " ""description"": ""#customBody"","
JSON(7) = " ""issuetype"": {"
JSON(8) = " ""name"": ""#issueName"""
JSON(9) = " },"
JSON(10) = " ""assignee"": {"
JSON(11) = " ""emailAddress"": ""#assignEmail"""
JSON(12) = " },"
JSON(13) = " ""labels"": ["
JSON(14) = " ""#jiraLabel"""
JSON(15) = " ]"
JSON(16) = " }"
JSON(17) = "}"
JSON = getJSON(CustomReplace(OutlookMail.Subject), CustomReplace(OutlookMail.Body), "Ticket", CustomReplace(OutlookMail.SenderName), "")
Do you have any idea how can I make this work with email address instead of name?
This is working:
JSON(0) = "{"
JSON(1) = " ""fields"": {"
JSON(2) = " ""project"": {"
JSON(3) = " ""id"": 23354"
JSON(4) = " },"
JSON(5) = " ""summary"": ""#customSubject"","
JSON(6) = " ""description"": ""#customBody"","
JSON(7) = " ""issuetype"": {"
JSON(8) = " ""name"": ""#issueName"""
JSON(9) = " },"
JSON(10) = " ""assignee"": {"
JSON(11) = " ""name"": ""#assignAlias"""
JSON(12) = " },"
JSON(13) = " ""labels"": ["
JSON(14) = " ""#jiraLabel"""
JSON(15) = " ]"
JSON(16) = " }"
JSON(17) = "}"
JSON = getJSON(CustomReplace(OutlookMail.Subject), CustomReplace(OutlookMail.Body), "Ticket", "myusername", "")
The ability to use usernames / email addresses for assignees / reporters for issues was deprecated years and years ago and replaced with using accountIDs. If you don't know a person's accountID, you have to search for it based on their username / email address.
picture probleme breakline
, I have a problem with my breakline not working properly in my either caculated fields or my expression.
I would like to split by created date and title etc...
do you know why it is not working ?
= "<b>"+ "Created on: " + "</b>" & CDate(Fields!ticket_ticketSolutions_date_create.Value).ToString("dd/MM/yy HH:mm")
& Environment.NewLine & Environment.NewLine &
"<b>" + "Approval date: " + "</b>" & iif(IsNothing(Fields!date_approval.value),"Not Approved",CDate( Fields!date_approval.Value).ToString("dd/MM/yy HH:mm"))
& Environment.NewLine &
Environment.NewLine &
"<b>" + "Solutions: " +"</b>" & Fields!ticket_ticketSolutions_content_plainText.Value
=Join( LookupSet(Fields!ticket_tickets_sourceId.value, Fields!itemId.value, Fields!start_end_solution_data.value, "Ticket_ticket_ticket_Solutions"), vbcrlf)
calculated fields ,
expression
It looks like you are using HTML tags in your text box. When using HTML, line breaks do not work.
Replace the NewLine with the HTML break tag <br>.
= "<b>"+ "Created on: " + "</b>" & CDate(Fields!ticket_ticketSolutions_date_create.Value).ToString("dd/MM/yy HH:mm") &
"<br><br>" & "<b>" + "Approval date: " + "</b>" &
IIF(IsNothing(Fields!date_approval.value), "Not Approved", CDate( Fields!date_approval.Value).ToString("dd/MM/yy HH:mm")) &
"<br>" & "<br>" & "<b>" + "Solutions: " +"</b>" & Fields!ticket_ticketSolutions_content_plainText.Value
strbody = strbody & "<font face=""Verdana"" size=""1""> <strong>" + Replace(name, "/", "-") + "</strong></font>"
When run the system to send out the email, there is no error in debug but the table interface will haywire because of this Replace().
I've tried as below but still not correct. Please help. Tq
Edit:
Replace(name, "/", "-") is correct syntax to use in code behind, but now I need to put it in html format in code behind for sending email. So I think I miss out some char to add. Like <font face=""Verdana"" , I need to put double "
'strbody = strbody & "<font face=""Verdana"" size=""1""> <strong>" + Replace(name, "" / "", "" - "") + "</strong></font>"
I have a report which has 6 parameters within it. What I would like to do is make these parameters part of my report heading. My parameters are as follows:
#BMDataType1 Text
#BMDataComp1 Float
#BMDataType2 Text
#BMDataComp2 Float
#BMDataType3 Text
#BMDataComp3 Float
There will always be an #BMDataType1 and #BMDataComp1 parameter passed, the others can be null. What I need the heading to look like is if only #BMDataType1 and #BMdataComp1 are passed then the heading should be for example:
Benchmark1 100% Benchmark Constituents
So far I have coded for this below:
=Parameters!BMDataType1.Value + " " + Parameters!BMDataComp1.Value.ToString + "%" + " Benchmark Constituents"
However if #BMDataType2 and #BMDataComp2 are populated then I need the heading to look like this:
Benchmark1 50% Benchmark2 50% Benchmark Constituents
Same for if 3 are passed then:
Benchmark1 50% Benchmark2 30% Benchmark3 20% Benchmark Constituents
There will never be say a Benchmark 1 and Benchmark 3. It will only be ever 1, or 1 and 2 or 1, 2 and 3.
Can someone point me in the right direction of how to write the IIF statement for this checking to see if Benchmark2 and Benchmark3 parameters are NULL?
Thanks
EDIT:
After some work on this I came up with the following code, but I'm still getting:
"Object reference not set to an instance of an object"
My code is the following:
=IIF(
IIF(IsNothing(Parameters!BMDataType1.Value),1,0)=0 AND IIF(IsNothing(Parameters!BMDataType2.Value),1,0)=1 AND IIF(IsNothing(Parameters!BMDataType3.Value),1,0)=1
, Parameters!BMDataType1.Value + " " + Parameters!BMDataComp1.Value.ToString + "%" + " Benchmark Constituents"
, IIF(
IIF(IsNothing(Parameters!BMDataType1.Value),1,0)=0 AND IIF(IsNothing(Parameters!BMDataType2.Value),1,0)=0 AND IIF(IsNothing(Parameters!BMDataType3.Value),1,0)=1
, Parameters!BMDataType1.Value + " " + Parameters!BMDataComp1.Value.ToString + "%" + " " + Parameters!BMDataType2.Value + " " + Parameters!BMDataComp2.Value.ToString + "%" + " Benchmark Constituents"
, IIF(
IIF(IsNothing(Parameters!BMDataType1.Value),1,0)=0 AND IIF(IsNothing(Parameters!BMDataType2.Value),1,0)=0 AND IIF(IsNothing(Parameters!BMDataType3.Value),1,0)=0
, Parameters!BMDataType1.Value + " " + Parameters!BMDataComp1.Value.ToString + "%" + " " + Parameters!BMDataType2.Value + " " + Parameters!BMDataComp2.Value.ToString + "%" + " " + Parameters!BMDataType3.Value + " " + Parameters!BMDataComp3.Value.ToString + "%" + " Benchmark Constituents"
, " ")))
However if all 3 parameters are not null it returns no error and it populates the heading as I would like it displayed. How can this be?
I have not been using SSRS since May, but string concatination in SSRS use VB syntax. So instead of concat strings with a + sign, you have to use the & sign.
=Parameters!BMDataType1.Value & " " & Parameters!BMDataComp1.Value.ToString & "%" & " Benchmark Constituents"
I found the solution to this and my code is as of below:
=Parameters!BMDataType1.Value + " " + CStr(Parameters!BMDataComp1.Value) + "% "
+ IIF(IIF(IsNothing(Parameters!BMDataType2.Value),1,0)=0,Parameters!BMDataType2.Value + " " + CStr(Parameters!BMDataComp2.Value)+"%","") + " "
+ IIF(IIF(IsNothing(Parameters!BMDataType3.Value),1,0)=0,Parameters!BMDataType3.Value + " " + CStr(Parameters!BMDataComp3.Value)+"%","") + " Benchmark Constituents"
For whatever reason it was not liking the .ToString which was returning "Oject reference not set to an instance of an object". By wrapping this in CStr I was able to remove the error and get the solution I required.
Thanks for all the responses, they all helped.
Something like this should work for you:
=Parameters!BMDataType1.Value + " " + Parameters!BMDataComp1.Value.ToString + "%" + IIf(IsNothing(Parameters!BMDataType3.Value) OR IsNothing(Parameters!BMDataComp3.Value), IIf(IsNothing(Parameters!BMDataType2.Value) OR IsNothing(Parameters!BMDataComp2.Value), " Benchmark Constituents", " " + Parameters!BMDataType2.Value + " " + Parameters!BMDataComp2.Value.ToString + "%" + " Benchmark Constituents"), " " + Parameters!BMDataType2.Value + " " + Parameters!BMDataComp2.Value.ToString + "%" + " " + Parameters!BMDataType3.Value + " " + Parameters!BMDataComp3.Value.ToString + "%" + " Benchmark Constituents")