COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: jessimica602 on 30 Jun 2021 04:05:31 PM

Title: Adding a "+" to spaces
Post by: jessimica602 on 30 Jun 2021 04:05:31 PM
Hey all,

Maybe I'm going about this all wrong or maybe someone has a better idea on how to do this...
I am trying to add a link to my report that has a google link to for finding the distance between two address; an example of the link is https://www.google.com/maps?f=d&source=s_d&saddr=9666+Old+Katy+Rd,+Houston,+TX+77055&daddr=901+Corbindale+Rd,+Houston,+TX+77024

I have the two fields for the addresses but can't figure out how to add the "+" in the spaces. Does anyone have an idea how to get this done, or a better idea how to handle this?

Thank you!!!!
Title: Re: Adding a "+" to spaces
Post by: BigChris on 01 Jul 2021 04:09:46 AM
Hi - you don't say what platform you're using, but if you're using SQL Server there's a function there that sounds like it would work for you:

replace ( string_expression1 , string_expression2 , string_expression3 )
Replaces all occurrences of "string_expression2" in "string_expression1" with "string_expression3".
Title: Re: Adding a "+" to spaces
Post by: jessimica602 on 21 Jul 2021 10:39:24 AM
Sorry for the long wait on this

Not SQL Server, just using query calculations in Cognos 11

I tried replace out of curiosity    replace([EE address Full],' ', '+')

but get the following error: "UDA-QOS-0006 error  UDA -SQL-0219 The function "replace" is being used for local processing but is not available as a built-in function, or at least one of its parameters is not supported"

I'm digging around seeing if there is any other solution to this.

Thank you!
Title: Re: Adding a "+" to spaces
Post by: jessimica602 on 21 Jul 2021 12:35:31 PM
Got it to work!!!!!!!!

Thank you!
Title: Re: Adding a "+" to spaces
Post by: bus_pass_man on 21 Jul 2021 01:46:49 PM
Would it be a violation of the Official Secrets Act to describe how you solved the problem, in case other people wish to do the same thing?
Title: Re: Adding a "+" to spaces
Post by: jessimica602 on 16 Nov 2021 12:49:16 PM
I am so sorry for the late response!!!
I didn't actually get the + to work... Google search did the work for me.

I have the following setup and working just fine:

Full Work Location Address field:  [Address 1 (Location)]+' '+[Facility City, State Zip Code]
Full EE Address Field: [Address Line 1 + Address Line 2]+' '+[City, State Zip Code (Formatted)]
Google Map Link Field:  'https://www.google.com/maps?f=d&source=s_d&saddr='+[Full Work Location Address]+'&daddr='+[Full EE Address]