I am creating a form that will generate sequential number for report types. Each number is sequential so first report is number 1 and second report is number 2 and so on.
The thing is, the report number needs to be in 4 digits, if the report number is not enough to make 4 digits, fill it in with 0's.
For example:
Report 1 number is 0001, report 2 number is 0002, report 10 number is 0010, report 100 number is 0100
I was thinking about adding 4 0's to the report number and do a substring formula, but the problem is I do not know the starting number.
Appreciate the help
I suggest to generate the report number once this is submitted by the user, this way you can get the sharepoint list id number, and then apply a simple set of rules like this:
Condition:
If Id does not match pattern Custom Pattern: \d{4}
Run this Actions
Set reportNumber's value: result = concat (substring("0000", 1 , 4 - string-length(Id))
Check the box to prevent the next rule to run when the condition is met
Add a new rule under this one just to print the Id if the condition is met.
So this way, numbers below 4 digits will be concatenated, and ids with 4 digits will just be displayed.
I hope this help you.
Related
I have a file which contains a list of data. In each cell is a name and number and a date the date is either mm/yy or mm-yy or mm-yyyy etc. (never the day just month and year)
The number I need is always going to be greater than 5 characters. Is there a way that I can get just the number from the string
xx company holding - 96923432 -02-22. (number required 96923432)
yy Company (HOLDINGS) LTD - 131002204 - 02/2023 (number required 131002204)
ab HOLDINGS LIMITED / 115472907 / Feb-23 (number required 115472907)
... prior removed
=========UPDATE=========
This formula will work for you, which splits your data by space, then converts to a number and then extracts the max. Adjust as needed if you have occasions where you may not have a number greater than 5 by wrapping with an IF().
=MAX(IFERROR(NUMBERVALUE(TEXTSPLIT(A2," ")),0))
This is interesting since you use 2 different delimiters. However, no worries you can simply use the following to capture both instances. If you have more possible delimiters simply just add them between the {} in both textbefore and textafter functions. Here is an example of the equation:=TEXTBEFORE(TEXTAFTER(A2, {"-","/"}), {"-","/"})
This should work for you then if you want to return nothing if output is less than 5. =IF(LEN(TEXTBEFORE(TEXTAFTER(A1,{"-","/"}),{"-","/"}))>5,TEXTBEFORE(TEXTAFTER(A1,{"-","/"}),{"-","/"}),"")
One of my Excel column of my board have to store numbers of 9 digits.
I'm looking for a solution to keep only the 9 last digits of any bigger number past in this specific column. It's only entire number.
Also if after formatting the number it appear that the number starts with 0 the 0 have to be kept. Is there another solution than adding an '0 at first ?
Here is what I already done : (i is the row number / Range01 is Range("A14:O400"))
If Len(Range01.Cells(i,5).value) = 9 Then
Range01.Cells(i,5).Interior.color = vbGreen
ElseIf Len(Range01.Cells(i,5).value) = 8 Then
Range01.Cells(i,5).value = "'0" & Range01.Cells(i,5).value
ElseIf Len(Range01.Cells(i,5).value) > 9 Then
????
Else
Range01.Cells(i,5).Interior.color = vbRed
End If
Thanks for the help.
The simplest way to get the last nine numbers of an integer is:
=MOD(A1,1000000000)
(For your information, that's one billion, a one with nine zeroes.)
If you're interested in showing a number with leading zeroes, you can alter the cell formatting as follows: (the format simply contains nine zeroes)
If you're interested in keeping the zeroes, you might need to use your number as a string, and precede it with a good number of repeated zeroes, something like:
=REPT("0",9-LEN(F8))&F8
Take the length of your number (which gets automatically converted into a string)
Subtract that from 9 (so you know how many zeroes you need)
Create a string, consisting of that number of zeroes
Add your number behind it, using basic concatenation.
You can simply use the math operator of modulus. If you want the last 9 digit you can write:
n % 10000000000
Where n is the number in the column.
In VBA:
MOD(n,1000000000)
This is an exmaple of the string, and it can be longer
1160752 Meranji Oil Sats -Mt(MA) (000600007056 0001), PE:Toolachee Gas Sats -Mt(MA) (000600007070 0003)GL: Contract Services (510000), COT: Network (N), CO: OM-A00009.0723,Oil Sats -Mt(MA) (000600007053 0003)
The result needs to be column1 600007056 column2 600007070 column3 600007053
I am working in Spotfire and creating calclated columns through transformations as I need the columns to join to other data sets
I have tried the below, but it is only picking up the 1st 600.. number not the others, and there can be an undefined amount of those.
Account is the column with the string
Mid([Account],
Find("(000",[Account]) + Len("(000"),
Find("0001)",[Account]) - Find("(000",[Account]) - Len("(000"))
Thank you!
Assuming my guess is correct, and the pattern to look for is:
9 numbers, starting with 6, preceded by 1 opening parenthesis and 3 zeros, followed by a space, 4 numbers and a closing parenthesis
you can grab individual occurrences by:
column1: RXExtract([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))',1)
column2: RXExtract([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))',2)
etc.
The tricky bit is to find how many columns to define, as you say there can be many. One way to know would be to first calculate a max number of occurrences like this:
maxn: Max((Len([Amount]) - Len(RXReplace([Amount],'(?<=\\(000)6\\d{8}(?=\\s\\d{4}\\))','','g'))) / 9)
still assuming the number of digits in each column to extract is 9. This compares the length of the original [Amount] to the one with the extracted patterns replaced by an empty string, divided by 9.
Then you know you can define up to maxn columns, the extra ones for the rows with fewer instances will be empty.
Note that Spotfire always wants two back-slash for escaping (I had to add more to the editor to make it render correctly, I hope I have not missed any).
So, I have a file that contains about 13000+ rows. Each row has a list of destinations separated by the char ";". I need to find between all those lists of destinations the 10 most common subsets (ignoring empty set or sets containing only 1 destination) between all the destinations, and the amount of times this subsets appear on the data:
An example may make this easier to understand:
This would be the file (each letter represents a destination)
A;B;C;D
A;B
A;B;C;D;E
A;B;C;D;E;F;G
A;B;C;D;E;F;G;H;L
C;G;B
K;H
So, the most common subsets of destinations together would be:
1. A;B : 5
2. A;C : 4
3. A;D : 4
4. A;B;C : 4
5. A;B;C;D : 4
6. A;E : 3
7. A;B;C;D;E : 3
8. B;C;D;E : 3
9. C;D;E : 3
10. A;B;C;D;E;F : 2
This problem seems very complex to me, I think it would be easier to solve it by limiting the size of the subsets to n (or a fixed number like 3).
Any ideas on how to solve it? I think I need something like FPGRowth but without the Association Rule generated.
Thanks!
you can solve this with one loop:
You have to generate a hashmap for saving the results...
you can give every destination a unique prime number and multiplicate the prime numbers of one line. the result is the key of the hashmap. if the key does not exist, you have to add it with a value of 1. If it exists, you can increase the value. This is called "Integer factorization". At the end you have to find the highest value number of your hashmap.
(hint: save the destination name also in the value of the hashmap,
then you do not have to recalculate the number to the destinations)
(2nd hint: remember the highest number and hashkey, so you don't have
to search at the end for the highest number and key...)
EDIT: for the combinations like A;B;C =>A;B and also B;C you can use 2 for loops to go through the line
I'm using DFSORT's ICETOOL DISPLAY operator to generate a list of accounts. I'm using a 'BREAK' on the branches to separate the accounts by sortcode and then sum the balance for the account. Everything works fine, but I get an additional entry(account) after summing the balance using BTOTAL. I've added my code below and the result so you better understand my question.
code
//SUR0007 JOB (5678),'ACCOUNTS'
//RUNIT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
DISPLAY FROM(INPUT2) LIST(REPORT) -
TITLE('LIST OF BANK ACCOUNTS BY BRANCH') -
HEADER('ACCOUNT') ON(2,8,BI,E'99999999') -
HEADER('BALANCE') ON(3,6,BI,E'99999999') -
HEADER('OWNER') ON(13,30,CH) -
BTITLE('SORTCODE:') BREAK(1,4,BI,E'999999') -
BTOTAL('BRANCH TOTAL:') -
TOTAL('GRAND TOTAL:')
/*
//INPUT2 DD DSN=USER.CICS.Z022.BANK.ACCOUNTS,DISP=SHR
//REPORT DD SYSOUT=*
result
SORTCODE:000012
ACCOUNT BALANCE
-------- --------
91317760 97999587
BRANCH TOTAL :
91317760 97999587
Expected result
SORTCODE:000012
ACCOUNT BALANCE
-------- --------
91317760 97999587
BRANCH TOTAL : 97999587
DFSORT's ICETOOL DISPLAY operator has many options, which means there is extensive documentation for it.
You should consult the DFSORT Getting Started manual for introductory-level use, and DFSORT Application Programming Guide for more high-level use.
Within BCOUNT, all numeric fields will appear with totals. Your account is numeric (binary), but if you can't make it non-numeric you can use NOST (you can pretend that means NO Sub-Totals) as part of the formatting for any field that you do not want to be summed automatically.
To get your BTOTAL text to appear on the same line as the totals, use STATLEFT in the report description.
Here's an example of the use of both from the Application Programming Guide:
DISPLAY FROM(ACCTS) LIST(FANCY) -
TITLE('Accounts Report for First Quarter') -
DATE(MD4/) BLANK -
HEADER('Amount') ON(12,6,ZD,C1,N08) -
HEADER(Id') ON(NUM,N02) -
HEADER('Acct#') ON(31,3,PD,NOST,LZ) -
HEADER('Date') ON(1,4,ZD,E'99/99',NOST) -
INDENT(2) BETWEEN(5) -
STATLEFT -
TOTAL('Total for Q1') -
AVERAGE('Average for Q1')
There is coding for a plain version of the same report:
DISPLAY FROM(ACCTS) LIST(PLAIN) -
TITLE('Accounts Report for First Quarter') -
DATE(MD4/) BLANK -
HEADER('Amount') ON(12,6,ZD) -
HEADER(Id') ON(NUM) -
HEADER('Acct#') ON(31,3,PD) -
HEADER('Date') ON(1,4,ZD) -
TOTAL('Total for Q1') -
AVERAGE('Average for Q1')
The output, with explanation from the example, is:
This example shows some options you can use to improve the appearance
of a DISPLAY report. The first DISPLAY operator produces a "plain"
report, and the second DISPLAY operator uses the options shown in bold
to produce a "fancy" report.
The PLAIN output starts on a new page and looks as follows:
Accounts Report for First Quarter 05/04/2001
Amount Id Acct# Date
--------------- --------------- ------------------- --------------------
93271 1 15932 106
137622 2 187 128
83147 3 15932 212
183261 4 2158 217
76389 5 187 305
920013 6 15932 319
Total for Q1
1493703 50328 1287
Average for Q1
248950 8388 214
The FANCY output starts on a new page and looks as follows:
Accounts Report for First Quarter 05/04/2001
Amount Id Acct# Date
-------- --- ------ -----
932.71 1 15932 01/06
1,376.22 2 00187 01/28
831.47 3 15932 02/12
1,832.61 4 02158 02/17
763.89 5 00187 03/05
9,200.13 6 15932 03/19
Total for Q1 14,937.03
Average for Q1 2,489.50
Here is an explanation of the extra options used for the "fancy"
report:
First ON field: In the PLAIN report, BLANK causes ICETOOL to print
the 6-byte ZD values as unedited digits with leading zeros suppressed.
But for this example, we know the digits really represent dollars and
cents. So in the FANCY report, we use the C1 formatting item (one of
thirty-three available masks) to print the values with a comma (,) as
the thousands separator and a period (.) as the decimal point.
In the PLAIN report, TOTAL causes ICETOOL to allow 15 digits for the
values because it does not know how many digits are needed. But
for this example, we know the total amount will not exceed 8 digits.
So in the FANCY report, we use the N08 formatting item to set the
number of digits to 8. This decreases the column width for the field.
Second ON field: In the PLAIN report, NUM causes ICETOOL to allow 15
digits for the record number because it does not know how many
digits are needed. But for this example, we know the number of records
will not exceed 99. So in the FANCY report, we use the N02 formatting
item to set the number of digits to 2. This decreases the column width
for the record number.
Third ON field: In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to
print the total and average for this 3-byte PD field. But
for this example, we know we do not want statistics for the field
because it is an account number. So in the FANCY report, we use the
NOST formatting item to suppress the statistics for this field.
In the PLAIN report, the default mask of A0 causes ICETOOL to suppress
leading zeros for this 3-byte PD field. But for this example,
we know that we want to show leading zeros for the field because it is
an account number. So in the FANCY report, we use the LZ formatting
item to print leading zeros for this field.
Fourth ON field: In the PLAIN report, BLANK causes ICETOOL to print the
4-byte ZD values as unedited digits with leading zeros
suppressed. But for this example, we know the digits represent a date
(month and day). So in the FANCY report, we use the E'99/99'
formatting item to print the values with leading zeros and a slash (⁄)
between the month and day.
In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to print the total
and average for this 4-byte ZD field. But for this example, we
know we do not want the total or average for this field because it is
a date. So in the FANCY report, we use the NOST formatting item to
suppress the statistics for this field.
Note: In some applications, we might want the minimum and maximum for a
date displayed with E'pattern', so we would not specify NOST for
the date field.
INDENT: In the PLAIN report, ICETOOL starts the report in column 2
(after the control character), by default. But for this example, we
want to indent the report a bit. So in the FANCY report, we use the
INDENT(2) operand to indent the report by 2 blanks so it starts in
column 4.
BETWEEN: In the PLAIN report, ICETOOL uses 3 blanks between the columns
of data, by default. But for this example, we want more space
between the columns. So in the FANCY report, we use the BETWEEN(5)
operand to insert 5 blanks between the columns.
STATLEFT: In the PLAIN report, ICETOOL prints the strings for TOTAL
and AVERAGE under the first column of data, by default, and uses
two lines for each statistic to avoid having the string overlay the
value. But for this example, we would like to have the TOTAL and
AVERAGE strings stand out in the report and also have each string on
the same line as its value. So in the FANCY report, we use the
STATLEFT operand to print the TOTAL and AVERAGE strings to the left of
the first column of data.
Here's the link, which also includes a "plain" version of the report to contrast with the fancy one: http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_Example_1110.htm
I located the link by search-engineing for icetool display statleft nost.