Custom formatting of a field in Sharepoint List - sharepoint

I have a sharepoint list. One of the fields in it(called DocNumber) is the document number including version. It will look like this ESI-1234-1.0
Basically the rule is, it should start with the text ESI-, then a number, followed by another hipen(-), followed by version number, then a dot(.), and a subversion number
How do i write the 'Column validation' for this. I'm using Sharepoint Online(365 I guess), so there's a placeholder in field level settings to write this formula. I searched online but the syntax is so difficult that I'm finding it hard to customize the formula -
I need something like this, but i don't want to indicate position because the numbers there could be of any length(its a serial number, currently we are at 1600, so we should support 1 to 5 digits atleast and version could be any number from 1 to 99)
=AND(
IF(ISERROR(FIND("ESI-",DocNumber,1)),FALSE,(FIND("ESI-",DocNumber)=1)),
IF(ISERROR(FIND("-",DocNumber,4)),FALSE,(FIND("-",DocNumber,4)=4)))
Thankyou for your help!

In the formula property of column You may use JSON structure like this:
{
"elmType": "div",
"txtContent": {
"operator": "+",
"operands": [
"ESI-",
"[$ID]",
"-",
"[$_UIVersionString]"
]
}
}
here we make a custom view in a div HTML element with text inside. The Text is static string "ESI-" then we add ID column then we add "-" then we add version number column as string
the result should be something like this
... I hope this will be of any help

Related

How do you return a value within a 2D array in Azure Data Flows Open Expression Builder?

Background: I have a CSV file with a column that has a list of tags for a given row. The tag list is not in any specific order and varies for each cell in the tags column. I am looking for the value for a row which matches the string "Owner". When pulling in the CSV file, the entire cell is 1 string per cell. An example cell in this column looks like following:
"Organization": "Microsoft", "Owner": "Eric Holmes", "DateCreated": "07/09/2021"
Goal: I would like to find a way in Azure Data Flows or Azure Data Factory to make a new column with a value for a specific key in a list.
Example:
Current Column
Tags
"Department": "Business", "Owner": "Karen Singh", "DateCreated": "09/20/2019"
"Owner": "Henry Francis", "AppName": "physics-engine", "Department": "GeospatialServices"
"Department": "Fashion", "DateCreated": "01/10/2015", "Owner": "Xiuxiang Long"
Desired Column
Owner
"Karen Singh"
"Henry Francis"
"Xiuxiang Long"
Work So Far: I have taken each string in the tags column split it into an array by breaking it apart and the commas (,). Then I have split each string at each index by the colon (:). This makes the values look like:
Tags
[["Department", "Business"], ["Owner", "Karen Singh"], ["DateCreated", "09/20/2019"]]
[["Owner", "Henry Francis"], ["AppName", "physics-engine"], ["Department", "GeospatialServices"]]
[[Department", "Fashion"], ["DateCreated", "01/10/2015"], ["Owner", "Xiuxiang Long"]]
To split the strings, I've used this open expression
mapIndex(split(replace(Tags, '"', ''), ','), split(#item, ':'))
Problems
I am new to Open Expressions and Azure Data Factory and Data Flows. Does anyone know how I would:
Search for the desired tag like "Owner"
And return the value associated to it
Sorry I know this question sounds very simple but using only open expression functions makes this more convoluted than necessary. Additionally, if there is a better way to go about this problem I'd appreciate any input! I've been banging my head against the wall and any leads help. Thank you!
I have tried to repro it, could achieve it using Derived Column, where you could Split():
Use Derived Column transformation and use below expression:
split(split(tags,'"Owner":')[2],'"')[2]
Data Preview:

Mongoose: Try finding a document with multiple conditions stored in an array

What I am trying to achieve is to find a document by its name and the language.
My current attempt looks like the following one:
Model.find({"name.language": languageIso2, "name.value": { "$regex": search, "$options": "i" }}, (error, SpecialConditons) => {...})
Unfortunately, it doesn't work, because of the following case:
lets say the language is "gb" and you use "a" as a filter for the name, this would send you the model shown in the picture above, because the array "name" contains both (1) the language "gb" and (2) the "a" in the object containing the Finnish translation "Touretten syndrooma".
What I want to achieve is to look for the object that contains "gb" as a language and if the object containing the "gb" also includes an "a" in the value field then it should send me the model back. In this case the value for "gb" doesn't contain an "a", so it should not send it back.
Any idea how to achieve this? Thanks in advance

How to remove all characters before a specific character in Cognos Report Studio 10.2

I have columns with different company names. In front of each company name there is a Company_ID. After the Company_ID a specific character = _ divides the ID from the Name. For example i have
111_Mercedes
11B4324_Apple
38A_Google
A1ZH8_Airline
I would like to remove all characters including the specific character.
Result should be
Mercedes
Apple
Google
Airline
Thanks in advance
If this is all in one data item and you need a pattern removed, try this:
As an example, 111_Mercedes 11B4324_Apple 38A_Google
The name starts with _ and ends with a space
Because of this, we can use the replace function to set up the process in two steps
1) Wrap the undesired portion in brackets
Sql would look like this
select
concat('<',replace(
replace('111_Mercedes 11B4324_Apple 38A_Google',' ','<')
,'_','>'))
FROM sysibm.sysdummy1
The result would look like
<111>Mercedes<11B4324>Apple<38A>Google
2) Then remove the content in the brackets
Sql would look like this:
Select trim(REGEXP_REPLACE(
'<111>Mercedes<11B4324>Apple<38A>Google'
, '<(.*?)>',' ',1,0,'c'))
FROM sysibm.sysdummy1
The result would look like this
Mercedes Apple Google
For Cognos try to use the functions in the data item definitions
BracketCompany = concat('<',replace(replace([Company ID],' ','<'),'_','>'))
Then another data item over this, to remove the content within the brackets
FinalCompany = trim(REGEXP_REPLACE([BracketCompany], '<(.*?)>',' ',1,0,'c'))

NPOI: Achieve Currency format as if formatted by Excel

I have seen some questions (like this one) here asking about if a cell in Excel can be formatted by NPOI/POI as if formatted by Excel. As most of you, I have to deal with issues with Currency and DateTime. Here let me ask how the formatting can be achieved as if it has been formatted by Excel? (I will answer this question myself as to demonstrate how to do it.)
Setting: Windows 10, English, Region: Taiwan
Excel format: XLSX (version 2007 and later)
(Sorry about various edit of this question as I have pressed the 'Enter' button at unexpected time.)
If you format a cell as Currency, you have 4 choices:
The internal format of each style is as follow:
-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00" numFmtId="164"/>
[RED]NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00;[Red]"NT$"#,##0.00" numFmtId="164"/>
-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00_);("NT$"#,##0.00)" numFmtId="7"/>
[RED]-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00_);[Red]("NT$"#,##0.00)" numFmtId="8"/>
Note: There is a pair of double quote (") comes before and after NT$.
(To get internal format of XLSX, just unzip it. The Style information is available in <unzip dir>\xl\Styles.xml Check out this answer if you need more information.)
(FYI: In formatCode, the '0' represent a digit. The '#' also represent a digit, but will not appear if the number is not large enough. So any number less than 1000 will not have the comma inside it. The '_' is a space holder. In format 3, '1.75' appears as 'NT$1.75 '. The last one is a space.)
(FYI: In numFmtId, for case 1 and case 2, number 164 is for user-defined. For case 3 and 4, number 7 and 8 are build-in style.)
For developers using POI/NPOI, you may find out if you format your currency column using Build In Format using 0x7 or 0x8, you can get only the third or fourth choice. You cannot get the first or second choice.
To get the first choice, you build upon style 0x7 "$#,##0.00);($#,##0.00)". You need to add the currency symbol and the pair of double quotes in front of it.
styleCurrency.DataFormat = workbook.CreateDataFormat().GetFormat("\"NT$\"#,##0.00");
Apply this format to a cell with number. Once you open the Excel result file, right click to check formatting, you will see the first choice.
Please feel free to comment on this post.
var cell5 = row.CreateCell(5, CellType.Numeric);
cell5.SetCellValue(item.OrderTotal);
var styleCurrency = workbook.CreateCellStyle();
styleCurrency.DataFormat= workbook.CreateDataFormat().GetFormat(string.Format("\"{0}\"#,##0.00", item.CurrencySymbol));//styleCurrency;
cell5.CellStyle = styleCurrency;
styleCurrency = null;
Iterate over loop for multiple currency.
Function to GetCurrencySymbol against currency Code on C#
private string GetCurencySymbol(string isOcurrencyCode)
{
return CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => !c.IsNeutralCulture)
.Select(culture =>
{
try
{
return new RegionInfo(culture.LCID);
}
catch
{
return null;
}
})
.Where(ri => ri != null && ri.ISOCurrencySymbol == isOcurrencyCode)
.Select(ri => ri.CurrencySymbol).FirstOrDefault();}

How to extract relationships from a text

I am currently new with NLP and need guidance as of how I can solve this problem.
I am currently doing a filtering technique where I need to brand data in a database as either being correct or incorrect. I am given a structured data set, with columns and rows.
However, the filtering conditions are given to me in a text file.
An example filtering text file could be the following:
Values in the column ID which are bigger than 99
Values in the column Cash which are smaller than 10000
Values in the column EndDate that are smaller than values in StartDate
Values in the column Name that contain numeric characters
Any value that follows those conditions should be branded as bad.
However, I want to extract those conditions and append them to the program that I've made so far.
For instance, for the conditions above, I would like to produce
`if ID>99`
`if Cash<10000`
`if EndDate < StartDate`
`if Name LIKE %[1-9]%`
How can I achieve the above result using the Stanford NLP? (or any other NLP library).
This doesn't look like a machine learning problem; it's a simple parser. You have a simple syntax, from which you can easily extract the salient features:
column name
relationship
target value or target column
The resulting "action rule" is simply removing the "syntactic sugar" words and converting the relationship -- and possibly the target value -- to its symbolic form.
Enumerate all of your critical words for each position in a lexicon. Then use basic string manipulation operators in your chosen implementation language to find the three needed fields.
EXAMPLE
Given the data above, your lexicons might be like this:
column_trigger = "Values in the column"
relation_dict = {
"are bigger than" : ">",
"are smaller than" : "<",
"contain" : "LIKE",
...
}
value_desc = {
"numeric characters" : "%[1-9]%",
...
}
From here, use these items in standard parsing. If you're not familiar with that, please look up the basics of a simple sentence grammar in your favourite programming language, with rules such as such as
SENTENCE => SUBJ VERB OBJ
Does that get you going?

Resources