Add a '~' symbol in the HL7 message - xslt

I have an HL7 Message exporting.
There's one field which has a tild symbol (~) in the input.
The HL7 is converting that into symbol "\R\"
I also tried exporting this value by using the ASCII value (126) for the '~' character using VBScript as I am .
But that was also converted by HL7 to "\R\"
How Can I get the '~' exported ?
Any Help would be appreciated.

HL7 escapes the repetition character "~" to "\R\" when transferring a message. The receiver should that change back to your tilde, when working with that field.
But there is a second way to deal with that issue. HL7 allows to change the encoding chars. Unfortunately not all HL7 engines support that.

This character (~) represents that this field can have multiple values.
Consider this PID.3 field from a given HL7 message
12345^^^XYZ~6789^^^PQR
What it means that, the patient has 2 patient ids coming from different sources viz. XYZ and PQR. This is what the (~) character means functionally.
If I go by the statement in the question body, I believe you want to achieve the functionality of (~).
To do this, try following below process. I don't know vbscript so I can't give you the code, however I have some Javascript code for the same, and I think you can mimic the same on vbscript. I'll leave that task to you.
//Calculates number of current repetitions by counting the length
var pidfieldlen=msg.PID['PID.3'].length();
//Store the last field node
var lastpidnode=msg['PID']['PID.3'][pidfieldlen-1]; //If length is 5,node index is 4
//Create new pid field and append with last pid node
var newpidfield=<PID.3/> //Creating new separate element for PID.3
newpidfield['PID.3.1']="567832" //Adding Field Values
newpidfield['PID.3.4']="NEW SOURCE"
lastpidnode.appendChild(newpidfield) //Adding above created to the last node
This will transform the PID.3 into
12345^^^XYZ~6789^^^PQR~567832^^^NEW SOURCE

Try to replace the tilde characters with ~ or ~ (decimal).
See the unicode reference for this character.
If you have already done so, this is not the source of error. I suspect that HL7 attaches a special meaning to this character. According to this webpage it denotes a "Field Repeat Separator".

Related

How do I extract the numbers after a phrase (xvth) and replace the phrase with "Group-"?

I have data being exported from BigQuery into Google Data Studio one field contains a username like the following.
xvth20-00-tt-wr
xvth27-00-pt-px
The first 4 characters (xvth) are always the same and the numbers that follow (xvth) correspond to a group. Multiple usernames will contain the same numbers after those characters but the rest of the string from 00- and on will be different.
What I'm trying to do is extract the numbers that follow the 4 characters and create a new field that looks like the following.
Group-20
Group-27
I've tried the following REPLACE(SUBSTR(Users,1, 6), 'xvth20', 'Group-20') and I will have to create one for every condition which seems like too much. Also the data will keep growing so I wouldn't want to keep going in and adding another function.
Is there an easier way to do this?
Either of the below REGEXP_REPLACE Calculated Fields will replace xvth with Group-, immediately followed by the respective captured numbers; Calculated Field #1 uses a Raw Literal, indicated by the letter r which requires a single \ to escape special RegEx characters whereas Calculated Field #2 requires \\ to escape a Google Data Studio RegEx as it does not use a Raw Literal:
1) With r (Raw Literal)
REGEXP_REPLACE(Users, r"^xvth(\d+).*", r"Group-\1")
2) Without r (Raw Literal)
REGEXP_REPLACE(Users, "^xvth(\\d+).*", "Group-\\1")
Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:

How to replace or ignore the Accented characters in SSIS

I have a SSIS package which reads the input file first & then validate it and then process the same. The validation is being carried through Script Task.
When the file is processed i am getting an error "invalid character in the given encoding". When verified i identified that this is due to the Accented character present in the file first name: André.
I tried replacing these characters in the xslt file using the replace(normalize-unicode()) function but its not working because the script task is being called initially.
Can anyone help me in ignoring/replacing these special character while processing the file?
In a dataflow task you can replace values using the applicable unicode hex value. The following code replaces three common accent marks with a blank space:
(DT_STR,500,1252)TRIM(REPLACE(REPLACE(REPLACE([YOUR_FIELD],"\x0060",""),"\x00B4",""),"\x02CB",""))
Find more here: http://www.utf8-chartable.de/

Flat file schema validation using regular expression - not allow new line and delimiter char

I know this must be primitive question but I am still not able to find a solution to my simple problem.
In a BizTalk solution, I want to validate a inbound flat file against a flat file schema (Delimiter char is pipe '|'). The rule is that there must be exact same number of fields in every record (every line). So after disassembling, none of the field must have new line char (CR LF or \r\n) and pipe '|' char.
Every line in flat file is a single record and there are 10 fields in every record. so there must me exact 9 '|' pipe chars in every line.
I tried to solve it using XSD regular expression validation but since regex is not my area of expertise, I am not able to create a final regex. Currently I am testing with .*(?!([^\r\n\|])).* but it doesn't work when there are more than 9 '|' chars however it works when there are less than 9.
Finally I want a XSD regex which must not allow a new line char and '|' in string but can have empty '' value.
I have referred below links to create my regex,
XML Schema Regular Expressions
XML Schema - Regular Expressions
I think you're trying to solve the wrong problem.
First, do you really need to do this? I don't recall ever needing or even considering what you're describing.
Second, you can just Validate the parsed Xml. If the field count is wrong, it will fail there. If you really need to check for extra '|', you can put that in the Schema to test for it in a Map.
IBM Integration Bus solves this problem by allowing you to describe the non-XML data format using an XSD. The technology is called Data Format Description Language (DFDL).
https://en.wikipedia.org/wiki/Data_Format_Description_Language

Remove or replace '�' character in Informatica

We have a requirement wherein we need to replace or remove '�' character (which is an unrecognizable, undefined character) present in our source. While running my workflow it runs successfully but when i check the records in target they are not committed. I get the following error in Informatica
Error executing query for record 37: 6706: The string contains an untranslatable character.
I tried functions like replace_chr, reg_replace, replace_str etc., but none seems to be working. Kindly advise on how to get rid of this. Any reply is greatly appreciated.
You need to use in your schema definitions charset=> utf8-unidode-ci
but now you can do:
UPDATE tablename
SET columnToCheck = REPLACE(CONVERT(columnToCheck USING ascii), '?', '')
WHERE ...
or
update tablename
set columnToCheck = replace(columnToCheck , char(146), '');
Replace NonASCII Characters in MYSQL
You can replace the special characters in an expression transformation.
REPLACESTR(1,Column_Name,'?',NULL)
REPLACESTR - Function
1 - Position
Column_Name - Column name which has a special character
? - Special character
NULL - Replacing character
You need to fetch rows with the appropriate character set defined on your connection. What is the connection you're using, ODBC or native? What's the DB?
Special characters are a challenge and having checked the informatica network I can see there is a kludge involving replace_str setting first a variable to the string with all non special characters first and then using the resulting variable in a replace_str so that the final value has only the allowed characters https://network.informatica.com/thread/20642 (awesome workaround by nico so long as you can positively identify every character that should be allowed) ...
As an alternate kludge I would also attempt something using an xml transformation somewhere within the mapping as informatica conveniently converts special characters to encoded (decimal or hex I cant remember) values... so long as you can live with these encoded values appearing in your target text you should be fine ( and build some extra space into your strings to accommodate any bloatage from the extra characters

How can I replace text in a Siebel data mapping?

I have an outgoing web service to send data from Siebel 7.8 to an external system. In order for the integration to work, before I send the data, I must change one of the field values, replacing every occurence of "old" with "new". How can I do this with EAI data mappings?
In an ideal world I would just use an integration source expression like Replace([Description], "old", "new"). However Siebel is far from ideal, and doesn't have a replace function (or if it does, it's not documented). I can use all the Siebel query language functions which don't need an execution context. I can also use the functions available for calculated fields (sane people could expect both lists to be the same, but Siebel documentation is also far from ideal).
My first attempt was to use the InvokeServiceMethod function and replace the text myself in eScript. So, this is my field map source expression:
InvokeServiceMethod('MyBS', 'MyReplace', 'In="' + [Description] + '"', 'Out')
After some configuration steps it works fine... except if my description field contains the " character: Error parsing expression 'In="This is a "test" with quotes"' for field '3' (SBL-DAT-00481)
I know why this happens. My double quotes are breaking the expression and I have to escape them by doubling the character, as in This is a ""test"" with quotes. However, how can I replace each " with "" in order to call my business service... if I don't have a replace function? :)
Oracle's support web has only one result for the SBL-DAT-00481 error, which as a workaround, suggests to place the whole parameter inside double quotes (which I already had). There's a linked document in which they acknowledge that the workaround is valid for a few characters such as commas or single quotes, but due to a bug in Siebel 7.7-7.8 (not present in 8.0+), it doesn't work with double quotes. They suggest to pass instead the row id as argument to the business service, and then retrieve the data directly from the BC.
Before I do that and end up with a performance-affecting workaround (pass only the ID) for the workaround (use double quotes) for the workaround (use InvokeServiceMethod) for not having a replace function... Am I going crazy here? Isn't there a simple way to do a simple text replacement in a Siebel data mapping?
first thing (quite possibly - far from optimal one) which is coming to my mind - is to create at source BC calculated field, aka (NEW_VALUE), which becomes "NEW" for every record, where origin field has a value "OLD". and simply use this field in integration map.