SQL UK Telephone Format Check - validation

I'm trying to create some sort of validation checker within SQL that will validate a UK telephone number, I've looked at some examples and can see that these are all US numbers which can contain hyphens and drop the leading zero however in the UK we keep the leading zero and don't hyphenate the number.
For example:
01234568790
0123 456 8790
0123 4568790
4568790
456 8790
These are all UK possibilities. Can someone please help me with this?

Related

SSRS: How to change value to negative in matrix based on column value

I have a matrix in SSRS which looks something like this:
Account DR/CR Amount
(acc_num) (drcr) (sum(amount)) = expression below
Total (sum(amount))
it returns this table
Account DR/CR Amount
123456789 CR 5000
DR 1000
Total 6000
987654321 CR 3000
DR 2000
Total 5000
Table should provide total amount for Credit and Debit items for specific account. Column DR/CR represents whether the item is credit or debit. I need to change DR amount to negative sign so it will be 5000-1000=4000 for account 123456789
I used expression for this in column Amount and first row in matrix:
=IIf((Fields!drcr.Value)="DR",(Sum(Fields!Amount.Value)*(-1)),Sum(Fields!Amount.Value))
This did not work and basically DR amount stayed the same
expected result
Account DR/CR Amount
123456789 CR 5000
DR -1000
Total 4000
987654321 CR 3000
DR -2000
Total 1000
Thank you
edit1: ok I realized that this is not a good way to do it. Matrix consists of data from sourcedata and totals are calculating from source data too, so changing +/- in matrix doesn't change totals
edit2: I changed expression in source data and matrix doesn't reflect the change for some reason. So I guess I run out of options. What do you think?
I also tried expression for totals:
=SUM((iif(Fields!DRCR.Value = CR, Sum(Fields!AmountLocal.Value),0))),(iif(Fields!DRCR.Value = DR, Sum((Fields!AmountLocal.Value)*(-1)),0))
returned end of statement missing error
Looks like you did most of the work on this answer for us. Yes, you are correct -- changing the value of the CR column doesn't change the value coming from the dataset so you do need to use an expression in the totals row. Looks like you may just have some misplaced or unnecessary parenthesis in that last expression. Try the following expression.
=SUM(iif(Fields!DRCR.Value = CR, Sum(Fields!AmountLocal.Value),0),(iif(Fields!DRCR.Value = DR, Sum((Fields!AmountLocal.Value)*(-1)),0)))
You had an unnecessary set of parenthesis around the CR IIF statement and the outermost SUM was being closed after that same IIF when it needed to be at the end.
I also want to recommend a tool like Notepad++ that has syntax highlighting. Basically, you highlight each parenthesis and you can easily see where it is matching up and address any issues on complex expressions like this one.

How do I get the report grouping to look at the whole number rather than the first two digits?

I have grouped everything by diameter but when I run the report it's only looking at the first two digits of the number, so groups them like:
10
101
104
11
112
116
12
I don't know how to get it to look at all 3 digits rather than the first 2.
I would assume that your issue stems from the datatype of the field you are grouping by. If the field is a VARCHAR, it will group as your report is currently grouping. If the field is a NUMERIC datatype, it will group by the full number. Check your query and verify that the field is providing the correct datatype and you should have a working grouping.

Customize order confirmation email in SagePay

We need to customize SagePay order confirmation mail.
We assigned 'eMailMessage'=><p>test</p>
Your order from abc has been successful.
The unique reference for this transaction is: 917-260650635
Dear Vijay V,
Thank you for your order. Your payment has been processed successfully.
test
Please quote your order number 917-260650635 in all correspondence with either abc or Sage Pay.
Bullet Point Order total:1,200.00 GBP
Card used:Sagepay Test Visa, United Kingdom - Visa - XXXX XXXX XXXX 5559 - Attempt:1
Bullet Point You bought:917-260650635
Description Quantity Item Value Item Tax Item Total Line Total
abc12 1 1200.000000 0.000000 1200.000000 1200.00
How we can customize complete template?
Edit:
We want to customize entire layout with Logo and other deatils:
Dear Xxxx Xxxxxx,
Thank you for your order with DDDD .
Your payment has been processed successfully.
The unique reference for this payment is XXX-XXXXXXXXXX, please quote this in all correspondence with either ABC or Sage Pay.
Order Total: £xxx.xx
Card Used : Name, Card Type , Last Four Digits XXXX
Your Order: Order Reference#
Sorry. You can't - you're limited to inserting the contents of the emailMessage field. You'll need to implement some sort of customer notification yourself, if you want to change the email styling / contents.

Google spreadsheets in-cell string length validation

I have a column where I want to write down numbers, but the numbers are long, 25 characters, and I could miss type it so at least knowing that I have typed the correct amount of characters would be helpful.
When typing in Google spreadsheets, I can validate the answer of a column within another column by using: '=IF(LEN(B1)=25,B1,"wrong number of digits")'
which means it would return the cell value if has 25 characters, but if its any other amount it will say wrong number, yet I need to use another column...
Is there any way that while I am typing in a cell it would let me proceed if right number of characters or give an error if I have wrong number of characters, in the same column?
UNTESTED
Please try a Data, Validation..., rule of:
=and(B1>999999999999999,len(B1)=25)

Basket numeric format

I'm developing Sage Pay Server protocol (3.00).
I noticed that in the Integration guideline manual the Amount field must be in UK currency format ("," to separate groups of thousands and "." to indicate the decimal place).
Do I have to use the same format for all numeric values in the Basket? (Quantity, Item value, Item Tax, Item Total, Line Total and number of lines of detail in the basket)
Thank you very much for your help and cooperation
regards

Resources