<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Bruce,<br>
<br>
Here is an idea. I let you decide if it's 'good'. <br>
<br>
The code in the attached file is:-<br>
<br>
<i>Public Sub Form_Open()</i><i><br>
</i><i>Dim sList As String[] = Split(File.Load("../codes"),
gb.newline)</i><i><br>
</i><i><br>
</i><i>Print sList[4617]</i><i><br>
</i><i>Print Split(sList[1329], "`")[0]</i><i><br>
</i><i>Print sList.Find("*NO_CHOC*", gb.Like)</i><i><br>
</i><i>Print sList[sList.Find("*NO_CHOC*", gb.Like)]</i><i><br>
</i><i><br>
</i><i>End</i><i><br>
</i><br>
Produces: -<br>
<br>
<i>A chocolate ice cream</i><i><br>
</i><i>Chocolate Ice Creams are out of stock today, offer another
flavor</i><i><br>
</i><i>1329</i><i><br>
</i><i>Chocolate Ice Creams are out of stock today, offer another
flavor` NO_CHOC</i><br>
<br>
Charlie<br>
<br>
On 21/11/2018 08:54, Bruce wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1809fe63-7ebf-92a6-1d17-7c67f11e1983@gmail.com">This has
been bothering me for some years.
<br>
<br>
It's fairly simple. We have a set of status codes that we use
across many applications. They are numeric (integer) and have a
code (the number), a mnemonic (short string) and an "explanation"
(i.e. a user interpret-able string that describes the status "in
full".
<br>
<br>
Here, there and everywhere within an application we need to set
the status code of something. Fairly plainly some method returns
an integer value that reflects the current status. Bing bong. But,
in order to do that we have to know from memory, when maintaining
the code for that some method, that "if this happens, then return
617" or whatever. This is a pain.
<br>
<br>
So, I'm trying to come up with some way that I could make a module
in a library that would let us access the status codes EITHER by
the code or by the mnemonic. I can neither get this clear in my
mind conceptually nor implementation-wise.
<br>
<br>
(EXAMPLE) Let's say we have an Ice Cream Parlor POS application
that is loosely connected to the inventory "system". If a
situation occurs where there is no chocolate ice cream in stock
then, when the POS operator presses key 4617 (a chocolate ice
cream) then it would display "Chocolate Ice Creams are out of
stock today, offer another flavor". So, code 1329 = that
explanation, but when I'm coding I'd like to specify the status as
"NO_CHOC" rather than go search through a bunch of design
documents and other stuff to find the right status code to use. I
hope that makes sense, it's the simplest explanation I can think
of. By the way, in reality we have around 1600 specific status
codes in our systems. So I am really hoping that someone has a
good idea here.
<br>
<br>
tia
<br>
Bruce
<br>
<br>
<br>
----[ Gambas mailing-list is hosted by <a class="moz-txt-link-freetext" href="https://www.hostsharing.net">https://www.hostsharing.net</a>
]----
<br>
</blockquote>
<br>
</body>
</html>