Total function does not compile - ms-access-2003

I am trying to provide a total of all outstanding voucher amounts.
In one place I have this code:
=DSum("[Voucher_Balance]"|"tblVoucherInfo"|"[Patient_number] = " & [No])
I try to mimic this code at the end of the page but it gives an error.
'the expression you entered has invalid vertical bars'
Is there any way to fix this? We want to show the total of voucher balance per each patient.
I have tried changing the 'Region and LAnguage' list separator on the PC to a comma but that has no effect.
i tried changing the | to a comma, !, . - all to no effect.

Remove those bars:
=DSum("[Voucher_Balance]","tblVoucherInfo","[Patient_number] = " & [No] & "")
If that doesn't sum, your field names or table are misspelled, or no valid value for [No] is passed.

Related

Postgresql: How to replace multiple substrings in a string and with regexp

Postgresql 9.4: 1 column in 1 table is a string of text representing a route of flight for an aircraft.
The complete field consists of "Fixes" and "Routes" up to 80
characters in total length.
Routes and Fixes can be either 3 or 5 characters in length.
Routes and Fixes can have the same name.
There may be zero, one, or two Routes
Routes are followed by a single non-zero digit or a hash.
Routes and Fixes can be preceded or followed by a "+" or "*".
The field may contain CR/LF or double-triple spaces which should remain.
Each schema contains 6-20000s fields in this table
There are nearly 1800 Route names, but generally only 40-80 per schema
Examples:
"KIND ROCKY1 STL BUM OATHE CLASH5 KDEN"
"+MEARZ7 OKK+
KIND OKK FWA MIZAR3 KDTW"
"KIND OOM OOM5 WEGEE PXV J131 LIT BYP5 KDFW"
"KIND MEARZ# OKK ECK YEE YXI N171B VALIEE***EGSS"
The task is to clean up the lazy use of the hash instead of a digit and to update the Route versions (the trailing numbers). I.e. replace-in-place the Route with the correct digit rather than the # or what might be a wrong number. So every instance of "MEARZ7" or "MEARZ#" becomes "MEARZ9" and "OOM5" becomes "OOM6" but "OOM " stays "OOM ".
Currently I have been testing this:
UPDATE target SET detail =
CASE WHEN POSITION('CLASH' in detail) > 0
AND SUBSTRING(detail,POSITION('CLASH' in detail)+5,1) != ' '
THEN REGEXP_REPLACE (detail, 'CLASH.', 'CLASH5')
WHEN POSITION('MEARZ' in detail) > 0
AND SUBSTRING(detail,POSITION('MEARZ' in detail)+5,1) != ' '
THEN REGEXP_REPLACE (detail, 'MEARZ.', 'MEARZ9')
WHEN POSITION('OOM' in detail) > 0
AND SUBSTRING(detail,POSITION('OOM' in detail)+3,1) != ' '
THEN REGEXP_REPLACE (detail, 'OOM.', 'OOM6')
WHEN POSITION('ROCKY' in fsrtedtail) > 0
AND SUBSTRING(detail,POSITION('ROCKY' in detail)+5,1) != ' '
THEN REGEXP_REPLACE (detail, 'ROCKY.', 'ROCKY1')
ELSE detail END;
My logic was to:
Find the Route name.
Check if it's followed by a space.
If not, replace it with the correct Route+digit
I hadn't yet attempted to avoid "+" or "* ". I was thinking I could first replace the "#" with a number, then update the Route+digit as to not worry about the # and this would eliminate the need to look for the "+" or "* ". Then I could just look for a trailing space.
The second Route (in order of the WHEN statements) does not get updated so I guess am barking up the wrong tree.
They other big obstacle is there can be 80 or more Routes in a schema so if I have to nest a statement, it's gonna be huge.
I have tried array_to_string(array_replace(string_to_array( but it leaves behind double quotes, commas, and curly brackets so doesn't seem feasible.
At this point I'm thinking a function is the way to go, but I don't know where to start.

Crystal Reports - Remove Carriage Returns

I am writing a report for my company right now and am running into issues with one data set in particular. Our accounting team puts unnecessary (as I see it) carriage returns when typing in data in one of our MISC_COMMENT fields.
Example data:
2 Returns
For warping
Cost = $1
RGA# 123
This comes out on the report as such... The report requester has asked that the data be as follows:
2 Returns For Warping Cost = $1 RGA 123
Is there anyway to strip out the carriage returns? Data will vary in characters and length. Not sure if a substring is still applicable then?
Thanks for the help!
Use the replace function to replace one or both of Chr(10) and Chr(13) depending on whether one or both exist inside your text.
Replace(Replace(MISC_COMMENT, Chr(13), " "), Chr(10), " ")

Group by formula field in report

To start from the beginning I had a long memo line that I needed to strip down to only show me a specific name in the string. Here is an example of the original memo line my report was giving me:
Ex. PLUMBERS-ACH distribution from share suffix 9 [2] 19.00 01DEC2017
I created three different formulas to strip down the memo line to only show me text before the "-". Here are those formulas:
Formula 1:
Left({SH_HIST.trn_memo}, instr(1,{SH_HIST.trn_memo},"-")-1)
Formula 2:
replace({Formula 1}, "-", " ")
Formula 3:
If instr({SH_HIST.trn_memo}, "-")>0 then {#Formula 2} else {SH_HIST.trn_memo}
I then placed Formula 3 into the report to give me the desired output from the memo line (this returns output successfully). Now I need to sort by that field because I need to be able to group all like items and sum them. When I click on "Insert Group" and select Formula 3 then try to preview the report I get the following message:
string length is less than 0 or not an integer
Can anyone lead me in the right direction to fix this, please? I've googled my heart out.
Instead of 3 formulas why don't you try this:
Split(Column,"-")[1] //Provided the format you gave applies for all records
Now group by this formula

Print fields being browsed on the screen

I need to write a FM script which print one field of the records being browsed on the screen and separated by commas.However, I do not know how to select the records being currently browsed and am not able to find it in the documentation (the lack of the good keyword could be the problem).
Thank you!
It sounds like you're trying to create a list of all values for one field in the Found Set. FileMaker 13 introduced the List of Summary type, which makes this pretty easy:
First, create a Summary field, say FoundAddresses. Make it a List of your e-mail address field. This field will contain a return-delimited list of the e-mail addresses in the Found Set.
Second, create a Calculation field, say FoundAddressesCommaDelimited. Make it the following text Calculation:
Substitute (
GetSummary ( FoundAddresses ; FoundAddresses ) ;
ΒΆ ; ", "
)
This will substitute all of the returns in FoundAddresses for comma-space.

Sorting a Drop-down (value) list by second field that's not displayed

How can I have a drop-down (value) list sorted by a second field (sortId) without showing that field? (I also want to include a "separator line".)
My current solution uses a second field of whitespaces to sort, but this leads to unfortunate behaviour.
Problem:
As the list needs to be dynamic (i.e. read from a table) I cannot use a Custom Value List.
The list should look like this:
zzz (sortId = 1)
aaa (sortId = 2)
bbb (sortId = 3)
------------------- (Does maybe also have to be defined with a sortId..)
uuu (sortId = 4)
lll (sortId = 5)
rrr (sortId = 6)
But the sortId should not be displayed in the drop-down list.
What I tried:
Since drop-down lists get sorted alphabetically I found out that there is this trick with using a second field which
contains "whitespaces" as sorting order. With a script/command:
Substitute(10^sortId - 1, "9", " ")
I am able to convert sortId into the correct amount of whitespaces. The sorting then works...
However, whitespaces are still shown in the Drop-down list and because we have maybe around 100 items in the value list it expands the drop-down to the right.
Another problem is that we need to use the "-" as separator line, but with this approach the "-" does not get replaced by the separator line, because the blank whitespaces are still filled behind it so its "- " and this
does not get replaced by the separator line.
I believe this technique is similar to what you've already tried, only it uses a 0-width Byte Order Mark, Char 65279:
http://www.soliantconsulting.com/blog/2012/09/extending-filemaker-pro%E2%80%99s-value-list-sort-capabilities-using-char-function
It won't give you functionality for the separator line, but you should be able to get a sortable list this way.