How to remove special character from string when post to database? - javascript

I have AngularJs tooltip for character counter where i am facing two problems.
1- Because of special character in the string its not saving it to db when copy paste below text in the text area.
2- It should only add 4000 character in the text area more than that should be escaped.
I have tried below code if i add more than 4000 character its going beyond 4000 and characters left is showing negative numbers in count and also failed to save.
How to resolve these problems ?
Ctrl.js
$scope.$watch('processDTO.processStatementText', function () {
if (!$scope.processDTO.processStatementText) {
$scope.processStatementTextTooltip = '4000';
}
else {
$scope.processStatementTextTooltip = 4000 - $scope.processDTO.processStatementText.replace(/[&<>"'\/]/g,'\r\n').length ;
}
});
main.html
<textarea rows="2" class="form-control"
ng-model="processDTO.processStatementText"
name="processStatement" id="processStatement"
placeholder="Process Statement" maxlength="4000" required
tooltip="{{processStatementTextTooltip}} characters left"
tooltip-trigger="{{{true: 'focus', false: 'never'}[processDTO.processStatementText.length >= 0 || processDTO.processStatementText.length == null ]}}"
tooltip-placement="top" tooltip-class="bluefill">
</textarea>
Text.txt
2. Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3. In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4. In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns.
5. ERH All levels added in the View End to End ERH screen – Sort and Filter doesn’t works, After clicking on this field, none of the other filter/sort works on the page. Also the sort indicator(black triangle) is not visible, I believe the column width needs to be adjusted.
6. The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7. The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2. Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3. In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4. In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns.

Related

How do you utilize a 'Data Validation' drop box as a 'Filter' condition?

Slightly complex formating, but I hope someone can direct me in the right direction.
Refer to this Demo Sheet before reading as I'll be referring to it throughout this post.
What I'm Trying to Accomplish: I'm trying to 'Filter' the "Ongoing Sales" sheet based on which store is selected (G13). I have a formula that will automatically populate the rows in each branded section and would like to add another condition to that formula stating the following:
If 'G13' is found in 'Current Markdown Sheet'!$P$16:AC16, display/filter the corresponding column if the value's in said column are greater than 0.
My current code (Which is filtering 'SKU's based off of brand names and if its men's, women's, or kids):
=FILTER('Current Markdown Sheet'!$B$16:$B, REGEXMATCH('Current Markdown Sheet'!$A$16:A, "ASICS"), REGEXMATCH(LEFT('Current Markdown Sheet'!$C$16:C,2), " M"))
Here are some visuals if my explanation wasn't good enough 😂:
^ Where I want the condition to go. (You can replace the &T(N("INSERT FILTER CONDITION HERE"))) ^
Some Rules to Follow:
You cannot alter the "Current Markdown Sheet" in anyway (Add data, remove data, etc).
I dont necessarily need it to show "All Stores", but if it's possible; Bonus points 😉.
Best of luck everyone, and I thank you in advance!
Cheers!
Try:
=FILTER('Current Markdown Sheet'!$B$16:$B, REGEXMATCH('Current Markdown Sheet'!$A$16:A, "ASICS"), REGEXMATCH(LEFT('Current Markdown Sheet'!$C$16:C,2), " M"),INDIRECT("'Current Markdown Sheet'!$"&regexextract(ADDRESS(16,MATCH(G13,'Current Markdown Sheet'!16:16,0)),"[A-Z]+")&"$16:$"&regexextract(ADDRESS(16,MATCH(G13,'Current Markdown Sheet'!16:16,0)),"[A-Z]+"))>0)
Result:
Explanation:
-Using the MATCH() to find the column of the match word from the dropdown, this returns the column index. You then use the ADDRESS() to get it's exact cell address, then REGEXTRACT() to only get the COLUMN letter:
regexextract(ADDRESS(16,MATCH(G13,'Current Markdown Sheet'!16:16,0)),"[A-Z]+")
-Now that you have the column, you can use the returned column to filter those greater than 0. You can also use column for the INDRECT() to refer to the dropdown.
References:
MATCH()
Convert Column number to Letter
INDIRECT()

BIRT - how do I force a column to output values in "Decimal"?

I can do that easily on an existing report by double-clicking a column that has no customized expression for it (i.e. dataSetRow["NAME_OF_COLUMN"]) but when I run into a column with a customized expression, I have no access to its data type, as double-clicking on it only opens the "Expression Builder" window.
Is there a way to somehow "cast" the result of the customized expression, or perhaps feed it into a function that does the conversion? I looked around the various options and settings, but found nothing related to my case.
To achieve the custom format for data, it is very helpful when you write Javascript which will format the column data dynamically.
There are other predefined methods are available which can be used to check if the value does not contains any decimal then you can add .00 to make decimal justified value.
If(!dataSetRow["NAME_OF_COLUMN"]).contains(".")) {
var xcustomeformat = dataSetRow["NAME_OF_COLUMN"]) + ".00";
}
Similary, if any value comes like 101.4 and you want out put as 101.40 then you can check the length of characters after decimal character and add additional ZEROs as needed.

SAPUI5 Association between 2 entities in the backend system?

I have 2 Entity sets
First one
and the second one
The red marked data in the first one are the same data as in the second one with blue marks.
I need the red one in the second pictures. So for example I got in this picture the entityset from the first picture of metadata there is Personalnummer, Mvorname, Mnachname. It should stay always Static.
Info: I got a calendar, when I click I want to change the Dauer for the Person for the day which I clicked. So thats why the other one stay static and only the Dauer is dynamic based on the day I click
The Dauer should came from the second picture of Metadata and the Pernr = PernrMitarbeiter, Vorname = Mvorname and Nachname = Mnachname
Is there a way to connect it with a Filter which is based on the Workdate?
So like get the data from the first one and check it with the second entity and than put the Dauer into the fields?
In the OData definition, create an association from ZOOWVM to ZOOWVTU_S - let’s call it duration - with cardinality 1:0..1 over the three foreign key fields. Then you can access the second entity via links of the form /ZOOWVMs(PernrMeister=‘a’,Auftrag=‘b’,PernrMitarbeiter=‘c’)/duration.
I do hope these names are scrambled for privacy’s sake. If they aren’t, you should really consider giving your entities and properties properly readable names.

Ngx-Bootstrap Typeahead retaining dropdown values on input clear

I've recently upgraded the ngx-bootstrap from 1.8.1 to 3.0.1 . After the upgrade type ahead doesn't seem to work as expected. I'm using this example :
https://valor-software.com/ngx-bootstrap/#/typeahead#async-data
with [typeaheadMinLength]="3"
Now , if I search, lets say "abcdef" then it starts searching after 3 characters have been typed that is abc and then abcd, abcde, abcdef and so on which is fine.
But now if I delete everything in input textbox using backspace in one go, that is if I make abcdef to empty by pressing backspace in one go, then once input is empty, it shows drop down values again which correspond to min length which is abc.
Ideally it should clear drop down values but looks like when you delete it very fast using backspace, it retains the values corresponding to min length token string.
It is more visible when data is fetched from a service and the data is huge, so it takes some time to load and clear.
Delay in service response can be emulated using typeaheadWaitMs and this issue can be replicated using this example : https://valor-software.com/ngx-bootstrap/#/typeahead#delay
https://github.com/valor-software/ngx-bootstrap/issues/4412
Could someone please help on this?
You have to put a check if search field is empty then clear the list holding values. When pressing backspace what happens is that when search length reaches threshold value i.e abc it fetches the result and stores it after that no operation is performed hence the search results for abc are persisted. Add (keyup)="onKey($event.target.value)" if value is empty clear the list holding your dropdown data.
As a workaround, I removed [typeaheadMinLength]="3" and instead checked the length on server. If length of prefix token is less than 3 , server doesn't do anything and instead returns empty array. This isn't the optimal solution ofcourse because even for length less than 3, requests will go to the server.
Although, I didn't feel any visible performance impact but still it could be better if done on UI rather than server.

Find first non-null value scanning rows backwards from current row

Software
I'm using Pentaho Data Integration 5.4
Input data & explanation
Input data from a file (simplified, there are more columns):
number name
1009 ProductA
2150 ProductB
3235 ProductC
ProductD
ProductE
1234 ProductF
7765 ProductG
4566 ProductH
ProductI
9907 ProductJ
The issue is that I had an Excel file format xlsx which has the data with merged cells, and for one value of id there are 1..n rows of values.
After converting that file to csv values for next rows (other than first) are missing, despite the one column which was not merged (see example id=3, id=6).
I'm generating a sequence using step Add sequence, the input is sorted the way it was originally stored in a file.
Steps to achieve the goal
Basically what I need to do is:
Find first non-null value that has sequence_number less than current_row.sequence_number
Concatenate the value from field name to that matching row
Keep scanning next rows with sequence_number higher than the last scanned
As stated before, there can be 1..n rows of values for such case.
Expected output
number name
1009 ProductA
2150 ProductB
3235 ProductC; ProductD; ProductE
1234 ProductF
7765 ProductG
4566 ProductH; ProductI
9907 ProductJ
My approach
I believe I'm able to do this in a loop, by using Analytic Query and calculating LAG(1) and then concatenating the column name for one row with null values and discarding other column values from null row - and then doing this in a loop (for like 20 times assuming this is maximum), but I do consider this a bad idea.
There are probably better ways to achieve this result using for example Java Script step with scanning the rows backward from current (based on sequence number), but I'm unaware of those functions, if they do exist.
How can I achieve this using Modified Java Script Value step, or any other efficient way without using a loop for entire content of the file until there are no empty rows?
To solve this, I would use Modified Java Script Value to save the last seen product and use this for all rows, and then use Group By to group the columns.
Introduction
Merged adjacent cells in Excel files are presented on the image below.
When opened as a plain text file, it actually creates gaps (data from merged cell is missing) for every row but first that contains the merged cell.
number name
1000/P um6p1
um1p2
um1p3
1500 um2p1
9823 um3p1
83424 um4p1
um4p2
um4p3
um4p4
21390 um5p1
While #bolav answer addresses the problem, there is a simplier and probably more efficient approach to this issue in Kettle.
Approach
In Microsoft Excel Input step go to Fields tab and mark Repeat option as Y for columns that store values in merged cells
Use Sort rows on number column because Group by step needs the input to be sorted
Group by on field number and aggregate name with Concatenate strings separated by as type and ; as value
From Pentaho User Guide:
Repeat If set to Y, will repeat this value if the field in the next row is empty.

Categories