How to comment script in Datamapper Mule - mule

I have a XML to XML mapping in DataMapper. Obviously soon after mapping done script will be present. How to I comment any line in script( Example here output.status line).
I have tried like this // but not seems to be commented.But could see by default Mule commented //MEL.
//MEL
//START -> DO NOT REMOVE
output.__id = input.__id;
//END -> DO NOT REMOVE
output.vendorReference = input.Ref;
output.status = input.overallStatus;
We know can remove the mapping or delete in script. But is there a any way we can comment it. Please suggest. Thanks in advance.

I could not understand why you want to comment the output status line.
Generally the scripting will allow // for commenting. In case of any filtering to be done then there are many features supported by MULE. Can you please elaborate your requirement so that we can help better.
http://blogs.mulesoft.com/7-things-you-didn%E2%80%99t-know-about-datamapper/
https://developer.mulesoft.com/docs/display/current/Datamapper+User+Guide+and+Reference#DatamapperUserGuideandReference-Examples

Related

Configure SQLFluff rules

I use SQLFluff to ensure a uniform syntax in the company and reduce error warnings before running the models in dbt. Since our syntax does not completely match the syntax of SQLFluff I would like to make some changes.
The Rules References provided by SQLFluff helped me to set up Inline Ignoring Errors, as displayed in the code below (last line of code).
So I have two questions, which I was not able to answer also with the help of the Rules References of SQLFluff.
I would like to set Rule L032 as default 'false' without typing it manually every time in my SQL.
How do I change the maximal length of a line regarding Rule L016? I would like to set the default value e.g. 150.
SELECT
country.country_name,
country.population,
currency.currency_name,
currency.currency_id,
currency.strange_long_variable_name_which_is_too_long as not_so_long_variable_name
FROM country
LEFT JOIN currency
USING (country) -- noqa: L032
I tried to figure it out with the Rules References but could not figure it out. Help is very much appreciated!
Try looking into .sqlfluff config file
https://docs.sqlfluff.com/en/stable/configuration.html#
With the help of #suhprano's answer, I was able to find the proper solution for my issue. For this reason, I will post an answer to my own question. I do this intending to provide others assistant with similar issues.
I created the .sqlfluff file in my user profile folder. In this file I have then included the following:
[sqlfluff]
exclude_rules = L032
[sqlfluff:rules]
max_line_length = 150
In this case, SQLFluff will load the configuration from any .sql file found at the path specified on this variable.
Just an addition to the answer:
The default config of the rules can be found inside the package in file core\default_config.cfg
See also:
https://github.com/sqlfluff/sqlfluff/blob/main/src/sqlfluff/core/default_config.cfg
https://docs.sqlfluff.com/en/stable/configuration.html#defaultconfig
As already mentioned by #Albin the easiest way to override the config is to add a .sqlfluff file in the user profile folder.
See also:
https://docs.sqlfluff.com/en/stable/configuration.html#rule-configuration

Formatting SQL Query Inside an IPython/Jupyter Notebook

I want to show some SQL queries inside a notebook. I neither need nor want them to run. I'd just like them to be well formatted. At the very least I want them to be indented properly with new lines, though keyword highlighting would be nice too. Does a solution for this exist already?
If you set the cell as Markdown one you can write the sql query as code specifying the language (e.g. mysql)
``` mysql
SELECT *
FROM table_a AS a
LIMIT 10;
```
This produces:
It highlights the keywords. Unfortunately, it doesn't seem to deal with indentation which seems to be the main issue you are trying to deal with but maybe this helps.
If you - like me - find yourself here because you want to highlight (and run) the %%sql magic, you're best of with the technique of this answer. Posting it here cause it took me quite some time before I found the correct keywords to my answer :)
require(['notebook/js/codecell'], function(codecell) {
codecell.CodeCell.options_default.highlight_modes['magic_text/x-mssql'] = {'reg':[/^%%sql/]} ;
Jupyter.notebook.events.one('kernel_ready.Kernel', function(){
Jupyter.notebook.get_cells().map(function(cell){
if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;
});
});
I found that this fixed the issue I was having.
``` sql
Produced styled code in edit mode but not when the cell was run.
``` mysql
Produced correct styling

VB.NET Console and RichTextBox difficulties

I am new here. I am very happy that I joined this website, because everyone here is so smart!
Now, let's cut to the chase! Hopefully, I will be able to explain everything properly.
I am creating a Visual Basic application. It's supposed to reassemble a so-called "fake programming language." It's having some issues though.
Let me show you an example before explaining:
If RichTextBox1.Text.Contains("console output >'insert comment';") then
Console.WriteLine("insert comment")
End If
Now, what I want here is a custom input. (if someone types "I want cookies" then I want the console to say that!
For instance, if I type:
If RichTextBox1.Text.Contains("console output >'Insert something here';") then
Console.WriteLine("Whatever the user wrote!")
End If
I just want to possibility to write whatever I want, that's all! I hope I made myself clear, because I am having a hard time explaining here. Help is appreciated! Thank you!
You need to match just the part with the console output > and then replace that portion of the string with empty space, like this:
If RichTextBox1.Text.Contains("console output >") Then
Console.WriteLine(Replace(RichTextBox1.Text, "console output >", ""));
End If

Chameleon: Why is a repeating comment truncated?

I'm having trouble with the transformation of an HL7 message. Its got an NTE segment with repeating fields of type string.
ex:
MSH|^~\&|HOST||TD-SYN||201207031000||ORU^R01|0017|P|2.3
PID|1||0001|
NTE|||Comment 1~Comment 2~Comment3
What happens after a graphical transformation is, NTE just takes Comment 1 and the rest of the repeating comments are ignored.
MSH|^~\&|HOST||TD-SYN||201207031000||ORU^R01|0017|P|2.3
PID|1||0001|
NTE|||Comment 1|
I tried setting the "Repeats" field of NTE segment's grammar to 10 but doesn't make a difference. Also, no script is manipulating that field of NTE, so I have no idea why it truncates it that way. Can someone tell me what's going on?
Glad you found it. Just as a general help, use sometimes the HAPI TestPanel to convert into XML, then you see very well how to loop over your HL7 elements. You then also know if you're using a correct HL7 structure.
In your example on the 3rd element in NTE <NTE.3>:
<?xml version="1.0" encoding="UTF-8"?>
<ORU_R01 xmlns="urn:hl7-org:v2xml">
<MSH>
<MSH.1>|</MSH.1>
<MSH.2>^~\&</MSH.2>
<MSH.3>
<HD.1>HOST</HD.1>
</MSH.3>
<MSH.5>
<HD.1>TD-SYN</HD.1>
</MSH.5>
<MSH.7>
<TS.1>201207031000</TS.1>
</MSH.7>
<MSH.9>
<CM_MSG.1>ORU</CM_MSG.1>
<CM_MSG.2>R01</CM_MSG.2>
</MSH.9>
<MSH.10>0017</MSH.10>
<MSH.11>
<PT.1>P</PT.1>
</MSH.11>
<MSH.12>2.3</MSH.12>
</MSH>
<ORU_R01.RESPONSE>
<ORU_R01.PATIENT>
<PID>
<PID.1>1</PID.1>
<PID.3>
<CX.1>0001</CX.1>
</PID.3>
</PID>
<NTE>
<NTE.3>Comment 1</NTE.3>
<NTE.3>Comment 2</NTE.3>
<NTE.3>Comment3</NTE.3>
</NTE>
</ORU_R01.PATIENT>
</ORU_R01.RESPONSE>
</ORU_R01>
I just found the answer from its documentation. It isn't actually truncated.
The default value of "value" is the first element in the repeatable field. Thus,
all I had to do is to access the repeating fields via field.repeat_field(index).value. :)

how to enable neocomplcache quick match?

I don't know how to enable quick match in the neocomplcache vim plugin. I put
let g:neocomplcache_enable_quick_match = 1
in my .vimrc, but it's useless. When I press - nothing happens.
According to the help file, there is no quick fix feature anymore. You need to use unite for that:
A: Quick match feature had been removed in latest neocomplcache
because quick match turned into hard to implement.
But you can use |unite.vim| instead to use quick match.
imap <expr> - pumvisible() ?
\ "\<Plug>(neocomplcache_start_unite_quick_match)" : '-'