Creating a Lookup Table

I'm going to create a lookup table for my charting application.

There aren't going to be very many items in this table, most likely
less than a 100. For the majority, no more than 20 items.

This table is to hold a symbol reference for the charts the user
creates. For example, say the user is viewing a chart of Cotton. How
this chart is actually named will be different for each user as they
can name it whatever they want. So what I want to do is give the user
the ability to assign the symbol (CT) to any chart that refers to
Cotton. This way, when the user pulls up a chart of Cotton in the
future with the specific name the user originally gave the chart (ex:
"May Cotton 2010"  or "Cotton May 2010" or "My Cotton Chart 0510" or
whatever, the program can lookup with the symbol is and retrieve "CT".

Now before you ask why this is not assigned when the chart was
originally created, the answer is thus:

This program is already out there and many users have already created
and named many charts. If I add a new field to the data structure that
currently describes the chart (such as the datafile name, the file
path, the name the user gave the data, etc.), this would cause
problems because this information is in a sequential file followed by
data for all the tools that the chart may or may not have. The file
load routine knows the order and structure size of each item (which is
variable).

Therefore, this lookup table has to be a new addition to an existing
program.

I'm thinking the route to go is to create a dynamic array due to its
small size. Then if the user selects a chart and runs a task that
needs to know what symbol is attached to it, I can then just loop
through the array looking for an item that matches the user named
chart and grab the symbol.

If the user later deletes the chart, I'll have to loop through the
array again, find the item, delete it, then run a 'gap fill' of some
sort on the array to remove the empty element.

If there is a better way to do this I'd like to find out what it is. I
know that a DB could be added to the program, but it just seems like a
lot more overhead in code/time for something that won't likely get
bigger than 20 and definitely not 100.

Ideas? Suggestions?

Thanks.

Webbiz

PS: If structure item "Symbol" of type String is known never to be
larger than 2 characters, is it better to define it as below or to
define it as 2 bytes within the structure def below? And if better to
assign it as 2 bytes, I assume that is String * 2?


Examples:

Type SYMBOLS
	ChartName as String
	Symbol as String
End Type

Public gSymbols() as SYMBOLS

....

gSymbols(0).ChartName = "Soybeans"
gSymbols(0).Symbol = "S"

gSymbols(1).ChartName = "Apr Live Cattle 2009"
gSymbols(1).Symbol = "LC"

etc. etc. 



0
Webbiz
3/7/2010 11:56:19 PM
vb.general.discussion 1016 articles. 0 followers. Follow

24 Replies
732 Views

Similar Articles

[PageSpeed] 10

Webbiz wrote:
> I'm going to create a lookup table for my charting application.
>
> There aren't going to be very many items in this table, most likely
> less than a 100. For the majority, no more than 20 items.
>
> This table is to hold a symbol reference for the charts the user
> creates. For example, say the user is viewing a chart of Cotton. How
> this chart is actually named will be different for each user as they
> can name it whatever they want. So what I want to do is give the
> user the ability to assign the symbol (CT) to any chart that refers
> to Cotton. This way, when the user pulls up a chart of Cotton in the
> future with the specific name the user originally gave the chart
> (ex: "May Cotton 2010"  or "Cotton May 2010" or "My Cotton Chart
> 0510" or whatever, the program can lookup with the symbol is and
> retrieve "CT".
>
> Now before you ask why this is not assigned when the chart was
> originally created, the answer is thus:
>
> This program is already out there and many users have already
> created and named many charts. If I add a new field to the data
> structure that currently describes the chart (such as the datafile
> name, the file path, the name the user gave the data, etc.), this
> would cause problems because this information is in a sequential
> file followed by data for all the tools that the chart may or may
> not have. The file load routine knows the order and structure size
> of each item (which is variable).
>
> Therefore, this lookup table has to be a new addition to an existing
> program.
>
> I'm thinking the route to go is to create a dynamic array due to its
> small size. Then if the user selects a chart and runs a task that
> needs to know what symbol is attached to it, I can then just loop
> through the array looking for an item that matches the user named
> chart and grab the symbol.
>
> If the user later deletes the chart, I'll have to loop through the
> array again, find the item, delete it, then run a 'gap fill' of some
> sort on the array to remove the empty element.
>
> If there is a better way to do this I'd like to find out what it
> is. I know that a DB could be added to the program, but it just
> seems like a lot more overhead in code/time for something that
> won't likely get bigger than 20 and definitely not 100.
>
> Ideas? Suggestions?
>
> Thanks.
>
> Webbiz
>
> PS: If structure item "Symbol" of type String is known never to be
> larger than 2 characters, is it better to define it as below or to
> define it as 2 bytes within the structure def below? And if better
> to assign it as 2 bytes, I assume that is String * 2?
>
>
> Examples:
>
> Type SYMBOLS
> ChartName as String
> Symbol as String
> End Type
>
> Public gSymbols() as SYMBOLS
>
> ...
>
> gSymbols(0).ChartName = "Soybeans"
> gSymbols(0).Symbol = "S"
>
> gSymbols(1).ChartName = "Apr Live Cattle 2009"
> gSymbols(1).Symbol = "LC"
>
> etc. etc.

With fewer than 100 symbols, practically anything you do will feel
instantaneous.

Since you're carrying the Symbol field in the array, the actual array
order doesn't matter and a deletion can just mean swapping the deleted
element with the last element, then ReDim Preserve the array one
element smaller. No shuffling needed.

-- 
        Jim

0
Jim
3/8/2010 1:09:27 AM
On Sun, 7 Mar 2010 20:09:27 -0500, "Jim Mack" <jmack@mdxi.nospam.com>
wrote:

>Webbiz wrote:
>> I'm going to create a lookup table for my charting application.
>>
>> There aren't going to be very many items in this table, most likely
>> less than a 100. For the majority, no more than 20 items.
>>
>> This table is to hold a symbol reference for the charts the user
>> creates. For example, say the user is viewing a chart of Cotton. How
>> this chart is actually named will be different for each user as they
>> can name it whatever they want. So what I want to do is give the
>> user the ability to assign the symbol (CT) to any chart that refers
>> to Cotton. This way, when the user pulls up a chart of Cotton in the
>> future with the specific name the user originally gave the chart
>> (ex: "May Cotton 2010"  or "Cotton May 2010" or "My Cotton Chart
>> 0510" or whatever, the program can lookup with the symbol is and
>> retrieve "CT".
>>
>> Now before you ask why this is not assigned when the chart was
>> originally created, the answer is thus:
>>
>> This program is already out there and many users have already
>> created and named many charts. If I add a new field to the data
>> structure that currently describes the chart (such as the datafile
>> name, the file path, the name the user gave the data, etc.), this
>> would cause problems because this information is in a sequential
>> file followed by data for all the tools that the chart may or may
>> not have. The file load routine knows the order and structure size
>> of each item (which is variable).
>>
>> Therefore, this lookup table has to be a new addition to an existing
>> program.
>>
>> I'm thinking the route to go is to create a dynamic array due to its
>> small size. Then if the user selects a chart and runs a task that
>> needs to know what symbol is attached to it, I can then just loop
>> through the array looking for an item that matches the user named
>> chart and grab the symbol.
>>
>> If the user later deletes the chart, I'll have to loop through the
>> array again, find the item, delete it, then run a 'gap fill' of some
>> sort on the array to remove the empty element.
>>
>> If there is a better way to do this I'd like to find out what it
>> is. I know that a DB could be added to the program, but it just
>> seems like a lot more overhead in code/time for something that
>> won't likely get bigger than 20 and definitely not 100.
>>
>> Ideas? Suggestions?
>>
>> Thanks.
>>
>> Webbiz
>>
>> PS: If structure item "Symbol" of type String is known never to be
>> larger than 2 characters, is it better to define it as below or to
>> define it as 2 bytes within the structure def below? And if better
>> to assign it as 2 bytes, I assume that is String * 2?
>>
>>
>> Examples:
>>
>> Type SYMBOLS
>> ChartName as String
>> Symbol as String
>> End Type
>>
>> Public gSymbols() as SYMBOLS
>>
>> ...
>>
>> gSymbols(0).ChartName = "Soybeans"
>> gSymbols(0).Symbol = "S"
>>
>> gSymbols(1).ChartName = "Apr Live Cattle 2009"
>> gSymbols(1).Symbol = "LC"
>>
>> etc. etc.
>
>With fewer than 100 symbols, practically anything you do will feel
>instantaneous.
>
>Since you're carrying the Symbol field in the array, the actual array
>order doesn't matter and a deletion can just mean swapping the deleted
>element with the last element, then ReDim Preserve the array one
>element smaller. No shuffling needed.


So you feel using an array as I mentioned is the way to go?

Webbiz
0
Webbiz
3/8/2010 4:33:01 AM
Sounds like a job for a collection of classes!!

 
0
Ivar
3/8/2010 8:36:36 AM
Webbiz wrote:
>
>
> So you feel using an array as I mentioned is the way to go?

Maybe not if you were starting from scratch, but here? Sure. It's a
tiny amount of data in the larger scheme. Practically anything you do
will be simple and fast.

I wouldn't use String * 2, because I never use FL strings. If you're
searching on that field there will be a lot of unnecessary conversions
to VL string and back. Better to just keep them as String.

Actually, if the data set won't often change during a run, then at
runtime (or whenever) I might concatenate all the .symbols into one
string, space-padded to a width of two in each section, and delimited
by something like pipes:

 |ST|R |AB|C |GM|   ... etc

Scanning for "C" then is very fast:

  Posn = Instr(Search$, "|C ") \ 3  ' -1 if 0-based array

Of course, if you don't search very often such optimizations are
academic.

-- 
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"

0
Jim
3/8/2010 1:12:58 PM
"Jim Mack" <jmack@mdxi.nospam.com> wrote

> Actually, if the data set won't often change during a run, then at
> runtime (or whenever) I might concatenate all the .symbols into one
> string, space-padded to a width of two in each section, and delimited
> by something like pipes:
>
>  |ST|R |AB|C |GM|   ... etc
>
> Scanning for "C" then is very fast:
>
>   Posn = Instr(Search$, "|C ") \ 3  ' -1 if 0-based array
>
> Of course, if you don't search very often such optimizations are
> academic.

If I might add my 3 cents...  I'd suggest allowing for 3 characters.

A long, long, long time ago (internet time...) consensus was that
two characters just wasn't enough.  There was the possiblity of
too many collisions as well as limited quantity.

Ever notice just how many commands and functions are 3 characters
long (from back in the days when the OS, the interpreter, and your
program had to fit in 64K)?

Asc, Chr, Clr, Cos, Dim, For, Get, Let, Len, Mid, Mod, ... etc., etc...

LFS



0
Larry
3/8/2010 2:20:26 PM
"Jim Mack" <jmack@mdxi.nospam.com> wrote

>   Posn = Instr(Search$, "|C ") \ 3  ' -1 if 0-based array

Shouldn't that be:

  idx = InStr(Names, "|C ") \ 3   ' + 1 if 1-based array


LFS





0
Larry
3/8/2010 2:27:44 PM
"Webbiz" <nospam@noway.com> wrote in message 
news:mad8p5lstridshvadvvfjmmenijgmijmsf@4ax.com...
> Type SYMBOLS
> ChartName as String
> Symbol as String
> End Type
>
> Public gSymbols() as SYMBOLS
>
> ...
>
> gSymbols(0).ChartName = "Soybeans"
> gSymbols(0).Symbol = "S"
>
> gSymbols(1).ChartName = "Apr Live Cattle 2009"
> gSymbols(1).Symbol = "LC"
>
> etc. etc.

This is very common, and simple to implement, especially if the array size 
is fixed. Below is a dynamic array version that auto expands as needed when 
adding more items. It's preferable that you put this in a class to make it 
easy to manage your code.

Output:

gSymbolsCount = 5
Item4 is at 4
'D' is at 4
gSymbolsCount = 4
Item4 is at 0
'D' is at 0


' Form1 code

Option Explicit

Private Sub Form_Load()
    SymbolsAdd "Item1", "A"
    SymbolsAdd "Item2", "B"
    SymbolsAdd "Item3", "C"
    SymbolsAdd "Item4", "D"
    SymbolsAdd "Item5", "E"

    Debug.Print "gSymbolsCount = " & gSymbolsCount

    Debug.Print "Item4 is at " & SymbolsFindChartName("Item4")
    Debug.Print "'D' is at " & SymbolsFindSymbol("D")

    SymbolsRemove 4

    Debug.Print "gSymbolsCount = " & gSymbolsCount

    Debug.Print "Item4 is at " & SymbolsFindChartName("Item4")
    Debug.Print "'D' is at " & SymbolsFindSymbol("D")

End Sub


' Module1 code

Option Explicit

Type TSymbols
    ChartName As String
    Symbol As String
End Type

Public gSymbols() As TSymbols
Public gSymbolsCount As Long

' Returns True when item successfully added, False when out of memory
Public Function SymbolsAdd(ByRef ChartName As String, _
    ByRef Symbol As String) As Boolean
    Dim i As Long

    On Error Resume Next

    i = UBound(gSymbols)
    If Err.Number <> 0 Then
        ' Not Redimmed before
        Err.Clear
        ReDim Preserve gSymbols(1 To 100)
        If Err.Number <> 0 Then
            ' Out of memory
            SymbolsAdd = False
            Exit Function
        End If
    End If

    If gSymbolsCount = UBound(gSymbols) Then
        ' Time to increase array size
        ReDim Preserve gSymbols(1 To UBound(gSymbols) + 100)
        If Err.Number <> 0 Then
            ' Out of memory
            SymbolsAdd = False
            Exit Function
        End If
    End If

    ' Add item to the array
    gSymbolsCount = gSymbolsCount + 1
    gSymbols(gSymbolsCount).ChartName = ChartName
    gSymbols(gSymbolsCount).Symbol = Symbol

    SymbolsAdd = True ' Success

End Function

Public Sub SymbolsRemove(ByVal Start As Long)
    Dim i As Long

    If Start >= 1 And Start <= gSymbolsCount Then
        For i = Start To gSymbolsCount - 1
            gSymbols(i) = gSymbols(i + 1)
        Next
        gSymbolsCount = gSymbolsCount - 1
    End If
End Sub

' Returns the index in gSymbols() array, 0 if not found
Public Function SymbolsFindChartName(ByRef ChartName As String) As Long
    Dim i As Long

    For i = 1 To gSymbolsCount
        If gSymbols(i).ChartName = ChartName Then
            SymbolsFindChartName = i
            Exit Function
        End If
    Next

End Function

' Returns the index in gSymbols() array, 0 if not found
Public Function SymbolsFindSymbol(ByRef Symbol As String) As Long
    Dim i As Long

    For i = 1 To gSymbolsCount
        If gSymbols(i).Symbol = Symbol Then
            SymbolsFindSymbol = i
            Exit Function
        End If
    Next

End Function



0
Nobody
3/8/2010 3:33:52 PM
Larry Serflaten wrote:
> "Jim Mack" wrote...
>
>>   Posn = Instr(Search$, "|C ") \ 3  ' -1 if 0-based array
>
> Shouldn't that be:
>
>   idx = InStr(Names, "|C ") \ 3   ' + 1 if 1-based array

Yes. The problem with off-the-cuff code...

Of course, we'd still have the issue of a not-found item. You probably
want to separate the InStr from the division by 3 -- or 4 (-: -- and
insert a test for 0.

-- 
        Jim

0
Jim
3/8/2010 3:34:00 PM
Given there are only two items in the structure, is this easier with 
Dictionary ?


0
Phil
3/8/2010 4:02:10 PM
Like others suggested, you can use a Dictionary object, but if you need to 
do more, you would have to make some workaround like using a separator 
character, but implementing your own would give you more control. Here is a 
class version of the code that I posted earlier:

Output:

Symbols Count = 5
Item4 is at 4
'D' is at 4
ChartName for 'C' is Item3
Symbol for chart name 'Item3' is C
Symbols Count = 4
Item4 is at 0
'D' is at 0

' Form1 code

Option Explicit

Private oSymbols As New CSymbols

Private Sub Form_Load()
    oSymbols.Add "Item1", "A"
    oSymbols.Add "Item2", "B"
    oSymbols.Add "Item3", "C"
    oSymbols.Add "Item4", "D"
    oSymbols.Add "Item5", "E"

    Debug.Print "Symbols Count = " & oSymbols.Count

    Debug.Print "Item4 is at " & oSymbols.FindChartName("Item4")
    Debug.Print "'D' is at " & oSymbols.FindSymbol("D")

    Debug.Print "ChartName for 'C' is " & oSymbols.GetChartName("C")
    Debug.Print "Symbol for chart name 'Item3' is " & _
                oSymbols.GetSymbol("Item3")

    oSymbols.Remove 4

    Debug.Print "Symbols Count = " & oSymbols.Count

    Debug.Print "Item4 is at " & oSymbols.FindChartName("Item4")
    Debug.Print "'D' is at " & oSymbols.FindSymbol("D")

End Sub



' CSymbols Class module code

Option Explicit

Private Type TSymbols
    ChartName As String
    Symbol As String
End Type

Private m_Symbols() As TSymbols
Private m_SymbolsCount As Long

' Returns True when item successfully added, False when out of memory
Public Function Add(ByRef ChartName As String, _
    ByRef Symbol As String) As Boolean

    Dim i As Long

    On Error Resume Next

    i = UBound(m_Symbols)
    If Err.Number <> 0 Then
        ' Not Redimmed before
        Err.Clear
        ReDim Preserve m_Symbols(1 To 100)
        If Err.Number <> 0 Then
            ' Out of memory
            Add = False
            Exit Function
        End If
    End If

    If m_SymbolsCount = UBound(m_Symbols) Then
        ' Time to increase array size
        ReDim Preserve m_Symbols(1 To UBound(m_Symbols) + 100)
        If Err.Number <> 0 Then
            ' Out of memory
            Add = False
            Exit Function
        End If
    End If

    ' Add item to the array
    m_SymbolsCount = m_SymbolsCount + 1
    m_Symbols(m_SymbolsCount).ChartName = ChartName
    m_Symbols(m_SymbolsCount).Symbol = Symbol

    Add = True ' Success

End Function

Public Sub Remove(ByVal Start As Long)
    Dim i As Long

    If Start >= 1 And Start <= m_SymbolsCount Then
        For i = Start To m_SymbolsCount - 1
            m_Symbols(i) = m_Symbols(i + 1)
        Next
        m_SymbolsCount = m_SymbolsCount - 1
    End If
End Sub

Public Property Get Count() As Long
    Count = m_SymbolsCount
End Property

' Returns the index in m_Symbols() array, 0 if not found
Public Function FindChartName(ByRef ChartName As String) As Long
    Dim i As Long

    For i = 1 To m_SymbolsCount
        If m_Symbols(i).ChartName = ChartName Then
            FindChartName = i
            Exit Function
        End If
    Next

End Function

' Returns the index in m_Symbols() array, 0 if not found
Public Function FindSymbol(ByRef Symbol As String) As Long
    Dim i As Long

    For i = 1 To m_SymbolsCount
        If m_Symbols(i).Symbol = Symbol Then
            FindSymbol = i
            Exit Function
        End If
    Next

End Function

' Returns the corrosponding Symbol name, empty string if not found
Public Function GetSymbol(ByRef ChartName As String) As String
    Dim i As Long

    For i = 1 To m_SymbolsCount
        If m_Symbols(i).ChartName = ChartName Then
            GetSymbol = m_Symbols(i).Symbol
            Exit Function
        End If
    Next

End Function

' Returns the corrosponding ChartName, empty string if not found
Public Function GetChartName(ByRef Symbol As String) As String
    Dim i As Long

    For i = 1 To m_SymbolsCount
        If m_Symbols(i).Symbol = Symbol Then
            GetChartName = m_Symbols(i).ChartName
            Exit Function
        End If
    Next

End Function

Private Sub Class_Terminate()
    Erase m_Symbols
End Sub


0
Nobody
3/8/2010 4:37:03 PM
On Mon, 8 Mar 2010 10:34:00 -0500, "Jim Mack" <jmack@mdxi.nospam.com>
wrote:

>Larry Serflaten wrote:
>> "Jim Mack" wrote...
>>
>>>   Posn = Instr(Search$, "|C ") \ 3  ' -1 if 0-based array
>>
>> Shouldn't that be:
>>
>>   idx = InStr(Names, "|C ") \ 3   ' + 1 if 1-based array
>
>Yes. The problem with off-the-cuff code...
>
>Of course, we'd still have the issue of a not-found item. You probably
>want to separate the InStr from the division by 3 -- or 4 (-: -- and
>insert a test for 0.


In this particular lookup, it's the long-winded description string
that gets searched on and the two-char string that is returned.

As to Larry's comment, I don't understand the 3-char suggestion. The
symbols have always been 2-char. What would the extra char serve?

Thanks. :-)
Webbiz
0
Webbiz
3/8/2010 4:58:16 PM
"Webbiz" <nospam@noway.com> wrote

> As to Larry's comment, I don't understand the 3-char suggestion. The
> symbols have always been 2-char. What would the extra char serve?

Very early on, the year 'had always' been represented using 2 digits....


....Until the Y2K scare made everyone rethink that idea.

Some may not agree, but I advocate planning ahead on the assumption
you will need to expand your designs, some time down the road.  In
other words, try to leave yourself a little extra room to grow, especially
if the cost to do so now is minimal.

Have you ever seen an SDK structure with extra bytes 'reserved'?

Examples:
   BITMAPFILEHEADER
   COMMCONFIG
   DCB
   MCI_WAVE_SET_PARMS
   MIDIHDR
   OFSTRUCT

Now some may be using bytes to help align the structure, while others
might be put to use by the service that uses the structure and what not,
but there are some there, where technological advancement may necessitate
the need for more information in the structure and such space has already
been alloted.  In other words, they expected more improvements to come,
and planned a little extra room in from the start.  I call that keeping an eye
on the future.  No one has a working crystal ball, but adding a little foresight
doesn't hurt, and usually doesn't cost that much in terms of time and resources.

LFS




0
Larry
3/8/2010 6:10:47 PM
Webbiz wrote:
>
> In this particular lookup, it's the long-winded description string
> that gets searched on and the two-char string that is returned.

Then it gets easier because your choice are limited. You just run
Instr (or whatever) on each one it turn. It would still be very fast.

> As to Larry's comment, I don't understand the 3-char suggestion. The
> symbols have always been 2-char. What would the extra char serve?

Just that if you hard-code a limit, you may find it insufficient later
on -- it's a caution not to code yourself into a corner. Just because
it's always been one way doesn't mean it won't need to change. The
upfront cost is minimal, compared to the cost of mods.

-- 
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"

0
Jim
3/8/2010 6:11:27 PM
"Webbiz" <nospam@noway.com> wrote

> In this particular lookup, it's the long-winded description string
> that gets searched on and the two-char string that is returned.

So would a Collection be the suitable vehicle?

  Set Symbols = New Collection
  Symbols.Add "CT", "May Cotton 2010"
  Symbols.Add "CT", "Cotton May 2010"
  Symbols.Add "CT", "My Cotton Chart 0510"
  Symbols.Add "S", "Soybeans"
  Symbols.Add "LC", "Apr Live Cattle 2009"
  ... etc...

  Such that you get the symbols back when you know the long name:

  sym = Symbols("Soybeans")

???
LFS


0
Larry
3/8/2010 6:17:11 PM
On Mon, 8 Mar 2010 11:37:03 -0500, "Nobody" <nobody@nobody.com> wrote:

>Like others suggested, you can use a Dictionary object, but if you need to 
>do more, you would have to make some workaround like using a separator 
>character, but implementing your own would give you more control. Here is a 
>class version of the code that I posted earlier:
>
>Output:
>
>Symbols Count = 5
>Item4 is at 4
>'D' is at 4
>ChartName for 'C' is Item3
>Symbol for chart name 'Item3' is C
>Symbols Count = 4
>Item4 is at 0
>'D' is at 0
>
>' Form1 code
>
>Option Explicit
>
>Private oSymbols As New CSymbols
>
>Private Sub Form_Load()
>    oSymbols.Add "Item1", "A"
>    oSymbols.Add "Item2", "B"
>    oSymbols.Add "Item3", "C"
>    oSymbols.Add "Item4", "D"
>    oSymbols.Add "Item5", "E"
>
>    Debug.Print "Symbols Count = " & oSymbols.Count
>
>    Debug.Print "Item4 is at " & oSymbols.FindChartName("Item4")
>    Debug.Print "'D' is at " & oSymbols.FindSymbol("D")
>
>    Debug.Print "ChartName for 'C' is " & oSymbols.GetChartName("C")
>    Debug.Print "Symbol for chart name 'Item3' is " & _
>                oSymbols.GetSymbol("Item3")
>
>    oSymbols.Remove 4
>
>    Debug.Print "Symbols Count = " & oSymbols.Count
>
>    Debug.Print "Item4 is at " & oSymbols.FindChartName("Item4")
>    Debug.Print "'D' is at " & oSymbols.FindSymbol("D")
>
>End Sub
>
>
>
>' CSymbols Class module code
>
>Option Explicit
>
>Private Type TSymbols
>    ChartName As String
>    Symbol As String
>End Type
>
>Private m_Symbols() As TSymbols
>Private m_SymbolsCount As Long
>
>' Returns True when item successfully added, False when out of memory
>Public Function Add(ByRef ChartName As String, _
>    ByRef Symbol As String) As Boolean
>
>    Dim i As Long
>
>    On Error Resume Next
>
>    i = UBound(m_Symbols)
>    If Err.Number <> 0 Then
>        ' Not Redimmed before
>        Err.Clear
>        ReDim Preserve m_Symbols(1 To 100)
>        If Err.Number <> 0 Then
>            ' Out of memory
>            Add = False
>            Exit Function
>        End If
>    End If
>
>    If m_SymbolsCount = UBound(m_Symbols) Then
>        ' Time to increase array size
>        ReDim Preserve m_Symbols(1 To UBound(m_Symbols) + 100)
>        If Err.Number <> 0 Then
>            ' Out of memory
>            Add = False
>            Exit Function
>        End If
>    End If
>
>    ' Add item to the array
>    m_SymbolsCount = m_SymbolsCount + 1
>    m_Symbols(m_SymbolsCount).ChartName = ChartName
>    m_Symbols(m_SymbolsCount).Symbol = Symbol
>
>    Add = True ' Success
>
>End Function
>
>Public Sub Remove(ByVal Start As Long)
>    Dim i As Long
>
>    If Start >= 1 And Start <= m_SymbolsCount Then
>        For i = Start To m_SymbolsCount - 1
>            m_Symbols(i) = m_Symbols(i + 1)
>        Next
>        m_SymbolsCount = m_SymbolsCount - 1
>    End If
>End Sub
>
>Public Property Get Count() As Long
>    Count = m_SymbolsCount
>End Property
>
>' Returns the index in m_Symbols() array, 0 if not found
>Public Function FindChartName(ByRef ChartName As String) As Long
>    Dim i As Long
>
>    For i = 1 To m_SymbolsCount
>        If m_Symbols(i).ChartName = ChartName Then
>            FindChartName = i
>            Exit Function
>        End If
>    Next
>
>End Function
>
>' Returns the index in m_Symbols() array, 0 if not found
>Public Function FindSymbol(ByRef Symbol As String) As Long
>    Dim i As Long
>
>    For i = 1 To m_SymbolsCount
>        If m_Symbols(i).Symbol = Symbol Then
>            FindSymbol = i
>            Exit Function
>        End If
>    Next
>
>End Function
>
>' Returns the corrosponding Symbol name, empty string if not found
>Public Function GetSymbol(ByRef ChartName As String) As String
>    Dim i As Long
>
>    For i = 1 To m_SymbolsCount
>        If m_Symbols(i).ChartName = ChartName Then
>            GetSymbol = m_Symbols(i).Symbol
>            Exit Function
>        End If
>    Next
>
>End Function
>
>' Returns the corrosponding ChartName, empty string if not found
>Public Function GetChartName(ByRef Symbol As String) As String
>    Dim i As Long
>
>    For i = 1 To m_SymbolsCount
>        If m_Symbols(i).Symbol = Symbol Then
>            GetChartName = m_Symbols(i).ChartName
>            Exit Function
>        End If
>    Next
>
>End Function
>
>Private Sub Class_Terminate()
>    Erase m_Symbols
>End Sub
>


Thanks for taking the time to write this code example NOBODY. Much
appreciated.

I like the idea of using ADD and REMOVE methods as part of a class.
Seems to be a 'clean' solution that is also portable if I have to do
this again in another project.

When it comes to Classes, I'm still a bit slow in catching on.  I'm
going to babble on here on what this is doing. If I'm off base, please
let me know.

The Form_Load() is where the object will be instantiated and data
loaded into it. I can put this anywhere I want in the app, but for my
purposes, the Form_Load() would fit just fine in triggering the
'SYMBOL OBJ INITIALISING' procedure. Within this procedure, I would
have to load the data from a datafile to restore all the previously
entered data.

Q: Might be a dumb question, but is it possible to save a class object
with its data to a file in one easy dump and load it as such to
restore it, or do I have to loop through all the records within the
class object when saving to and loading from disk?

Q. Would it be wise/unwise to have the data load (from file) as part
of the Class, perhaps as the Class Constructor triggered when an
object is created from it? And then, to have all the data saved back
to the file as part of the Class Destructor (Terminate?) ?


Q. I find it interesting this technique of deliberately causing an
error in order to branch to a different routine, such as the initial
Redim of m_Symbols. Is this common practice?


I'm thinking that my class won't need the Remove, FindChartName,
FindSymbol and GetChartName routines. The GetChartName routine, if I
were to keep it, would have to be modified anyway as it is possible to
have more than one chart with the same symbol (although not the other
way around).

The only thing that needs to be returned from the object is the Symbol
based on the Chartname supplied. Once I know the Symbol that was
assigned to a chart, I can run the methods specific to that symbol
elsewhere in code.

This class will need a different type of 'Remove' routine though. I'll
add this where the item is deleted and filled in with the last item
(as suggested by another) since the order is not important within the
array.

Thanks!

Webbiz
0
Webbiz
3/8/2010 6:53:46 PM
On Mon, 8 Mar 2010 12:17:11 -0600, "Larry Serflaten"
<serflaten@usinternet.com> wrote:

>
>"Webbiz" <nospam@noway.com> wrote
>
>> In this particular lookup, it's the long-winded description string
>> that gets searched on and the two-char string that is returned.
>
>So would a Collection be the suitable vehicle?
>
>  Set Symbols = New Collection
>  Symbols.Add "CT", "May Cotton 2010"
>  Symbols.Add "CT", "Cotton May 2010"
>  Symbols.Add "CT", "My Cotton Chart 0510"
>  Symbols.Add "S", "Soybeans"
>  Symbols.Add "LC", "Apr Live Cattle 2009"
>  ... etc...
>
>  Such that you get the symbols back when you know the long name:
>
>  sym = Symbols("Soybeans")
>
>???
>LFS
>


Don't laugh, but I'll have to read on 'Collections' as I've never used
it personally.

The user of the program can name his charts whatever he wants. But in
order to retrieve information specific to the data loaded into the
chart, the symbol needs to be associated with it.

Each week, I will have a text file that can be downloaded which
contains these symbols and some important data associated with it.
There are 20 symbols.

I have no idea how the user named his charts, so I have to leave it up
to the user to assign the correct symbol to the respective chart.

The app, noting there is a symbol file on the drive, will load this
file into the app. 

When the user is viewing a chart that has been assigned to a symbol,
the user can select the additional data be displayed on his chart by
way of keypress, mouse click, menu or whatever. The app will load the
text file that was downloaded so as to have the symbols and the
associated data. The app will match the symbol assigned to the chart
to the symbol in this file to get the correct additional data. This
data is then applied to the chart in some way.

Right now, the users already may have 10, 20 or more charts created
from use over the previous months/years. When this feature is added,
the user will have to update the app of course. Then the user will
need to start assigning the symbols to the charts. 

Naturally, when the user exists the program the symbol assignments
need to be saved so that the next time the app is run it will remember
the assignments. If a chart is ever deleted, I will need to remove the
chartname ->> symbol reference. If the user, for whatever reason,
wants more than one chart to be assigned to the same symbol, this is
to be allowed. Of course one cannot assign more than one symbol to a
single chart though.

That's it in a rather large nutshell. Can collections deal with this? 

I'm currently toying with NOBODY's Class suggestion and code.

Thanks.

Webbiz

0
Webbiz
3/8/2010 7:06:46 PM
"Webbiz" <nospam@noway.com> wrote in message 
news:gkbap59vi85c1gpmfcb21lmsj4tv5unnrh@4ax.com...
> Thanks for taking the time to write this code example NOBODY. Much
> appreciated.
>
> I like the idea of using ADD and REMOVE methods as part of a class.
> Seems to be a 'clean' solution that is also portable if I have to do
> this again in another project.
>
> When it comes to Classes, I'm still a bit slow in catching on.  I'm
> going to babble on here on what this is doing. If I'm off base, please
> let me know.
>
> The Form_Load() is where the object will be instantiated and data
> loaded into it. I can put this anywhere I want in the app, but for my
> purposes, the Form_Load() would fit just fine in triggering the
> 'SYMBOL OBJ INITIALISING' procedure. Within this procedure, I would
> have to load the data from a datafile to restore all the previously
> entered data.
>
> Q: Might be a dumb question, but is it possible to save a class object
> with its data to a file in one easy dump and load it as such to
> restore it, or do I have to loop through all the records within the
> class object when saving to and loading from disk?

I haven't used this, so I don't know the details, but check the help for 
"PropertyBag object". You will find a topic called "Persisting a Component's 
Data". It probably doesn't apply to Standard EXE projects. Other than that, 
you can provide your own Load/Save functions that take a file name and save 
the information there. You can call these functions from 
Initialize/Terminate events, but these events don't return error codes, so 
it's best to call Load/Save methods explicitly. You can show a MsgBox, but I 
tend to avoid GUI code in classes and return an error code, and let the 
calling form show a MsgBox. This is just in case I use that class in a 
non-GUI app later, such as a command line only tool, or ActiveX in a web 
server, or as a service, which cannot show a GUI.

> Q. Would it be wise/unwise to have the data load (from file) as part
> of the Class, perhaps as the Class Constructor triggered when an
> object is created from it? And then, to have all the data saved back
> to the file as part of the Class Destructor (Terminate?) ?

That's fine. See the above.

> Q. I find it interesting this technique of deliberately causing an
> error in order to branch to a different routine, such as the initial
> Redim of m_Symbols. Is this common practice?

That's very common and perfectly fine, especially when ReDim'ing arrays for 
the first time.


0
Nobody
3/8/2010 7:25:44 PM
On Sun, 7 Mar 2010 20:09:27 -0500, "Jim Mack" <jmack@mdxi.nospam.com>
wrote:


>With fewer than 100 symbols, practically anything you do will feel
>instantaneous.
>
>Since you're carrying the Symbol field in the array, the actual array
>order doesn't matter and a deletion can just mean swapping the deleted
>element with the last element, then ReDim Preserve the array one
>element smaller. No shuffling needed.


How does this look in doing that? This is a method in my CSymbol
Class.

Public Sub Delete(ByRef ChartName As String)

Dim i As Long, j As Long
Dim bResize As Boolean

    On Error Resume Next
    
    i = UBound(m_Symbols)
    
    If Err.number <> 0 Then
        Exit Sub
    Else
            
        If m_Symbols(i).ChartName = ChartName Then 'delete last record
by resizing only
            bResize = True
        Else
            For j = 0 To i
                If m_Symbols(j).ChartName = ChartName Then 'match
                    m_Symbols(j) = m_Symbols(i) 'Transfer last record
over one to remove
                    bResize = True
	         Exit For
                End If
            Next j
        End If
    
    End If
    
    If bResize Then 'Resize to remove last element
        If i > 0 Then
            ReDim Preserve m_Symbols(i - 1)
        Else
            Erase m_Symbols
        End If
    End If
    
End Sub
0
Webbiz
3/8/2010 11:27:02 PM
On Mon, 08 Mar 2010 17:27:02 -0600, Webbiz <nospam@noway.com> wrote:

>On Sun, 7 Mar 2010 20:09:27 -0500, "Jim Mack" <jmack@mdxi.nospam.com>
>wrote:
>
>
>>With fewer than 100 symbols, practically anything you do will feel
>>instantaneous.
>>
>>Since you're carrying the Symbol field in the array, the actual array
>>order doesn't matter and a deletion can just mean swapping the deleted
>>element with the last element, then ReDim Preserve the array one
>>element smaller. No shuffling needed.
>
>
>How does this look in doing that? This is a method in my CSymbol
>Class.
>
>Public Sub Delete(ByRef ChartName As String)
>
>Dim i As Long, j As Long
>Dim bResize As Boolean
>
>    On Error Resume Next
>    
>    i = UBound(m_Symbols)
>    
>    If Err.number <> 0 Then
>        Exit Sub
>    Else
>            
>        If m_Symbols(i).ChartName = ChartName Then 'delete last record
>by resizing only
>            bResize = True
>        Else
>            For j = 0 To i
>                If m_Symbols(j).ChartName = ChartName Then 'match
>                    m_Symbols(j) = m_Symbols(i) 'Transfer last record
>over one to remove
>                    bResize = True
>	         Exit For
>                End If
>            Next j
>        End If
>    
>    End If
>    
>    If bResize Then 'Resize to remove last element
>        If i > 0 Then
>            ReDim Preserve m_Symbols(i - 1)
>        Else
>            Erase m_Symbols
>        End If
>    End If
>    
>End Sub



I think maybe this one is better?


Public Sub Delete(ByRef ChartName As String)

Dim i As Long, j As Long
Dim bResize As Boolean

    
    If m_SymbolsCount > 0 Then
            
        If m_Symbols(m_SymbolsCount).ChartName = ChartName Then
'delete last record by resizing only
            If m_SymbolsCount = 1 Then
                Erase m_Symbols
                mSymbolsCount = 0
                Exit Sub
            End If
        Else
            For j = 1 To m_SymbolsCount
                If m_Symbols(j).ChartName = ChartName Then 'match
                    m_Symbols(j) = m_Symbols(m_SymbolsCount) 'Transfer
last record over one to remove
                    ReDim Preserve m_Symbols(m_SymbolsCount - 1)
                    mSymbolsCount = mSymbolsCount - 1
                    Exit Sub
                End If
            Next j
        End If
    
    End If
    
End Sub


Webbiz
0
Webbiz
3/8/2010 11:38:33 PM
Webbiz wrote:
>
> I think maybe this one is better?

I didn't study it, but it's the right idea.

If you're adding and removing on a regular basis, I wouldn't bother
with the ReDim on delete, just decrement the count after swapping. I'd
use m_SymbolCount as the current max when searching, and check it
against UBound when adding. I'd also ReDim upward by 10 elements
rather than one at a time if I needed to add an element.

-- 
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"






>
>
> Public Sub Delete(ByRef ChartName As String)
>
> Dim i As Long, j As Long
> Dim bResize As Boolean
>
>
>     If m_SymbolsCount > 0 Then
>
>         If m_Symbols(m_SymbolsCount).ChartName = ChartName Then
> 'delete last record by resizing only
>             If m_SymbolsCount = 1 Then
>                 Erase m_Symbols
>                 mSymbolsCount = 0
>                 Exit Sub
>             End If
>         Else
>             For j = 1 To m_SymbolsCount
>                 If m_Symbols(j).ChartName = ChartName Then 'match
>                     m_Symbols(j) = m_Symbols(m_SymbolsCount)
> 'Transfer last record over one to remove
>                     ReDim Preserve m_Symbols(m_SymbolsCount - 1)
>                     mSymbolsCount = mSymbolsCount - 1
>                     Exit Sub
>                 End If
>             Next j
>         End If
>
>     End If
>
> End Sub
>
>
> Webbiz

0
Jim
3/9/2010 12:43:37 AM
Webbiz:

Didn't read all the posts so hope I'm not off base here.

I believe your design may run into a few problems.
Each data vendor has a separate symbol that is unique to them.
That may be different than the one the user may name it.

Using a class is OK, but I think you need to make some provisions, a table 
works well, to cross reference the vendor symbol to the users designated 
symbol.


David


"Nobody" <nobody@nobody.com> wrote in message 
news:eiqp2UvvKHA.1692@TK2MSFTNGP04.phx.gbl...
> "Webbiz" <nospam@noway.com> wrote in message 
> news:gkbap59vi85c1gpmfcb21lmsj4tv5unnrh@4ax.com...
>> Thanks for taking the time to write this code example NOBODY. Much
>> appreciated.
>>
>> I like the idea of using ADD and REMOVE methods as part of a class.
>> Seems to be a 'clean' solution that is also portable if I have to do
>> this again in another project.
>>
>> When it comes to Classes, I'm still a bit slow in catching on.  I'm
>> going to babble on here on what this is doing. If I'm off base, please
>> let me know.
>>
>> The Form_Load() is where the object will be instantiated and data
>> loaded into it. I can put this anywhere I want in the app, but for my
>> purposes, the Form_Load() would fit just fine in triggering the
>> 'SYMBOL OBJ INITIALISING' procedure. Within this procedure, I would
>> have to load the data from a datafile to restore all the previously
>> entered data.
>>
>> Q: Might be a dumb question, but is it possible to save a class object
>> with its data to a file in one easy dump and load it as such to
>> restore it, or do I have to loop through all the records within the
>> class object when saving to and loading from disk?
>
> I haven't used this, so I don't know the details, but check the help for 
> "PropertyBag object". You will find a topic called "Persisting a 
> Component's Data". It probably doesn't apply to Standard EXE projects. 
> Other than that, you can provide your own Load/Save functions that take a 
> file name and save the information there. You can call these functions 
> from Initialize/Terminate events, but these events don't return error 
> codes, so it's best to call Load/Save methods explicitly. You can show a 
> MsgBox, but I tend to avoid GUI code in classes and return an error code, 
> and let the calling form show a MsgBox. This is just in case I use that 
> class in a non-GUI app later, such as a command line only tool, or ActiveX 
> in a web server, or as a service, which cannot show a GUI.
>
>> Q. Would it be wise/unwise to have the data load (from file) as part
>> of the Class, perhaps as the Class Constructor triggered when an
>> object is created from it? And then, to have all the data saved back
>> to the file as part of the Class Destructor (Terminate?) ?
>
> That's fine. See the above.
>
>> Q. I find it interesting this technique of deliberately causing an
>> error in order to branch to a different routine, such as the initial
>> Redim of m_Symbols. Is this common practice?
>
> That's very common and perfectly fine, especially when ReDim'ing arrays 
> for the first time.
>
> 


0
David
3/9/2010 2:43:23 AM
On Mon, 8 Mar 2010 21:43:23 -0500, "David" <NoWhere@earthlink.net>
wrote:

>Webbiz:
>
>Didn't read all the posts so hope I'm not off base here.
>
>I believe your design may run into a few problems.
>Each data vendor has a separate symbol that is unique to them.
>That may be different than the one the user may name it.
>
>Using a class is OK, but I think you need to make some provisions, a table 
>works well, to cross reference the vendor symbol to the users designated 
>symbol.
>
>
>David
>
>
>"Nobody" <nobody@nobody.com> wrote in message 
>news:eiqp2UvvKHA.1692@TK2MSFTNGP04.phx.gbl...
>> "Webbiz" <nospam@noway.com> wrote in message 
>> news:gkbap59vi85c1gpmfcb21lmsj4tv5unnrh@4ax.com...
>>> Thanks for taking the time to write this code example NOBODY. Much
>>> appreciated.
>>>
>>> I like the idea of using ADD and REMOVE methods as part of a class.
>>> Seems to be a 'clean' solution that is also portable if I have to do
>>> this again in another project.
>>>
>>> When it comes to Classes, I'm still a bit slow in catching on.  I'm
>>> going to babble on here on what this is doing. If I'm off base, please
>>> let me know.
>>>
>>> The Form_Load() is where the object will be instantiated and data
>>> loaded into it. I can put this anywhere I want in the app, but for my
>>> purposes, the Form_Load() would fit just fine in triggering the
>>> 'SYMBOL OBJ INITIALISING' procedure. Within this procedure, I would
>>> have to load the data from a datafile to restore all the previously
>>> entered data.
>>>
>>> Q: Might be a dumb question, but is it possible to save a class object
>>> with its data to a file in one easy dump and load it as such to
>>> restore it, or do I have to loop through all the records within the
>>> class object when saving to and loading from disk?
>>
>> I haven't used this, so I don't know the details, but check the help for 
>> "PropertyBag object". You will find a topic called "Persisting a 
>> Component's Data". It probably doesn't apply to Standard EXE projects. 
>> Other than that, you can provide your own Load/Save functions that take a 
>> file name and save the information there. You can call these functions 
>> from Initialize/Terminate events, but these events don't return error 
>> codes, so it's best to call Load/Save methods explicitly. You can show a 
>> MsgBox, but I tend to avoid GUI code in classes and return an error code, 
>> and let the calling form show a MsgBox. This is just in case I use that 
>> class in a non-GUI app later, such as a command line only tool, or ActiveX 
>> in a web server, or as a service, which cannot show a GUI.
>>
>>> Q. Would it be wise/unwise to have the data load (from file) as part
>>> of the Class, perhaps as the Class Constructor triggered when an
>>> object is created from it? And then, to have all the data saved back
>>> to the file as part of the Class Destructor (Terminate?) ?
>>
>> That's fine. See the above.
>>
>>> Q. I find it interesting this technique of deliberately causing an
>>> error in order to branch to a different routine, such as the initial
>>> Redim of m_Symbols. Is this common practice?
>>
>> That's very common and perfectly fine, especially when ReDim'ing arrays 
>> for the first time.
>>
>> 
>


Hello David.

The symbols they use are the ones that I use and supply. It is my file
that they will download and the app will load. So to use the feature,
they must match up the symbols available in my download file to their
charts.

Thanks.

Webbiz
0
Webbiz
3/9/2010 3:40:43 AM
"Webbiz" <nospam@noway.com> wrote

> The user of the program can name his charts whatever he wants. But in
> order to retrieve information specific to the data loaded into the
> chart, the symbol needs to be associated with it.

<snipped for brievity>

> That's it in a rather large nutshell. Can collections deal with this?

A Collection would only help for the look-up side of the problem, it
would not be suitable for saving to the disk.

Keep in mind you can design the process in any number of ways,
so why not pick a method that will be easy for you to both; store
to disk, and work with, in the program?

You indicated that a user might assign different charts (with
different names) to the same base symbol.  Thats a design requirement;
the user is allowed to use multiple names that all reference the
same base symbol.  How many is 'multiple'?  Ideally, you would
want no limitation (within reason) on the number of different charts
so it needs to be somewhat open ended in terms of relating the names
to their symbol.

Also, you want to avoid trouble from charts that have similar names,

"S" = "Chart 1"
"CL" = "Chart 2"
"CT" = "Chart"

When you go looking for "Chart" in a bunch of strings, you want to
be sure to find the one related to CT and not either of the other two.
That means you need to make each name unique, or as Jim has shown,
store them with delimiters.

It may help to first look at how you want to lay out the data in the file,
to make that easy for the program to read and store.  Then with that
file format, look for methods that would be suitable for translating
the long names to their base symbols.

One obvious (to some, anyway) solution would be to put each symbol
on one line in the file, followed by the different user names for that symbol:

CT|May Corn 2010|Corn May 2010|
S|Soybean|
GT|
CL|April Lettuce 2010|Spring Lettuce|
.... etc ...

A file like that could be read into string memory in one go, and Split
into an array for use in the program.

When you need to find the symbol for a name, you loop through the
array testing each line (InStr) until a match is found.  When you have a
match, you know the first few characters of that line is the desired symbol.

Something like that could be implemented in a BAS module, or in a class,
if that is how you want to go....

LFS




0
Larry
3/9/2010 1:44:48 PM
On Tue, 9 Mar 2010 07:44:48 -0600, "Larry Serflaten"
<serflaten@usinternet.com> wrote:

>
>"Webbiz" <nospam@noway.com> wrote
>
>> The user of the program can name his charts whatever he wants. But in
>> order to retrieve information specific to the data loaded into the
>> chart, the symbol needs to be associated with it.
>
><snipped for brievity>
>

>You indicated that a user might assign different charts (with
>different names) to the same base symbol.  Thats a design requirement;
>the user is allowed to use multiple names that all reference the
>same base symbol.  How many is 'multiple'?  Ideally, you would
>want no limitation (within reason) on the number of different charts
>so it needs to be somewhat open ended in terms of relating the names
>to their symbol.
>
>Also, you want to avoid trouble from charts that have similar names,
>
>"S" = "Chart 1"
>"CL" = "Chart 2"
>"CT" = "Chart"
>

Fortunately the user cannot name two charts the same. So 'similar'
names would not be an issue since the comparison must be EXACT, not
simply contain some similarity.

"Chart" and "Chart 1" and "Chart  1" are all different names as far as
the app is concerned.  It's a complete string comparision that must
match, not a partial only.

However, I have made some minor changes. The user can only assign a
symbol to a chart when that chart happens to be loaded and in view
mode. At that point, the chart's unique 'filename' is found in a
global chart name variable. An example would be "S098376.prv". Each
chart has a unique file name that holds all the unique values for that
chart, including the path and filename of the actual data file it
loads. So when the user has a chart loaded and wants to use the tool
that requires a symbol, the app will ask for the symbol and then
assign it to the name of the .prv file associated with that chart.
Even 5 charts of Soybeans will all have their own unique .prv file, as
each chart will likely have diffent things drawn on it, etc.

The app will now only ask for a symbol if one has never been assigned
to it.

This appears to be working out so far. More testing ahead!  :-)

Thanks.

Webbiz
0
Webbiz
3/9/2010 7:28:28 PM
Reply:

Similar Artilces:

create a roster
How can you create a weekly roster in which functions can be assigned to more than 10 people. The roster should be updatable, so that when holidays and days off are marked on the weekly roster they will be taken account of it future rosters. ...

importing or creating reference footnotes
I am trying to import a word document into publisher and it has reference footnotes within the document. The reference footnotes are not coming into the publisher document with the reference footnotes. Correct, they will not up to Publisher 2003. In Publisher 2003 depending on which version of Word you are using if they will or not. -- "If you don't know where you are going, any road will take you there!" ...

Mailbox not created when AD account created
A couple of days ago I noticed that I created a user account but the 'Email Addresses' tab of the user properies did not list any email addresses. Subsequent new user accounts have all experienced the same. I researched the knowledge and tried the recommended solutions to either manaully start the recipient update service or rebuild te recipient update service. Neither recommendation has resulted in a mailbox being created for this particular user or any additional user that I have created since this error first showed up. I performed a Windows update last Thursday and so I bel...

Task Create - Status
I'm trying to make a simple task, when a user owner is assigned a task in CRM, it receives an email letting it know it has one. I have the following below, but it is not generating one when i assign one manually in the CRM. What to do? I've tried both the following: When task is created E-Mail to:[owner];Subject test As well as: When task is created if Task activity status = Open then E-Mail to:[owner];Subject test I've checked the mailserver many times over, and I can send emails manually from the CRM so you can rule that out Tested out ok on our end. Some ideas:...

Bug with cell merging in tables using Applescript
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Once you have merged cells in a table in Word 2008 using Applescript, any further reference to the table's cells in the script produce an error. <br><br>As an example, open Word 2008 and run this script: <br> tell application &quot;Microsoft Word&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;make new table at active document with properties {number of rows:4, number of columns:4} <br> &nbsp;&nbsp;&nbsp;&nbsp...

Help Creating XmlNode / XmlAttribute Elegantly
I am creating a configuration class to read / write a standard configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="ConnectionString" value="server=(local);" /> </appSettings> </configuration> I am using a XmlDocument for my base implementation. I am looking to see if there is a better way to add a new node / attribute than using XmlDocument.InnerXml. I would consider this to be a hack but couldn't really see another way of doing this without definin...

Splitting one table into multiple tables/tabs
Hi I was wondering if anyone can help me split a table into multiple tables or tabs. If I have a table of 20 customers with various transactions over time all in one table. I'd like to know if it's possible to seperate the table into multiple tables based on the change in customer number and have them broken into multiple tabs without manually creating each tab and then cut and pasting. I really appreciate any help! Thanks! ...

Create external database
Hi all. I need to create an external database (file). On a site I found this code: ------------------------------------------------------ Function CreateLinkedExternalTable(strTargetDB As String, strProviderString As String, strSourceTbl As String, strLinkTblName As String) As String 'strTargetDB = Source Database Name 'strProviderString = Not used, currently hard coded 'strSourceTbl = Source Table name in the database we are linking too. 'strLinkTblName = Table name we would like to see in the Access Database. Dim catDB As ADOX.Catalog Dim tblLink As...

tabls in GP90 database
Does anyone know or have a description or documenation on the tables in the database for GP90? Maybe all I need is the important ones. thanks Within the program itself, Tools > Resource Descriptions Also, there are ERD's on the distribution CD's that you got when you purchased or upgraded the system - you have to install the SDK to get at them. -- Lyle U Adam Clark wrote: > Does anyone know or have a description or documenation on the tables > in the database for GP90? Maybe all I need is the important ones. > > thanks ...

Data Tables
Has anyone ever had a problem where a data table is producing incorrect values? I have a (two dimensional) table which is producing unexpected values. When I try to replicate these values through manually changing the inputs (and changing nothing else) I get a different result to that produced by the data tables. Just to check I'm not going completely mad, I've had a colleague confirm the symptoms. Any suggestions gratefully received before I head into investigating for corruptions etc Mike The only time I've ever had a problem with charting is when I had merged c...

How to create pie chart with %
I have got a problem that I don't if excel could help me to calculate the % within a column and draw a pie chart. My case is I have a column containing a series of numbers. e.g. 1,4,8,1,3,9,11,2,4,5,6,.........etc I want to draw a pie chart that showing 1-3 , 4-6, 7-9, >9 with the corresponding % inside that column. Can anyone tell me how can I make it ? Ray - You need to calculate the frequencies in your data. Let's assume your data is in A1:A12. In B1:B3 enter these numbers, the upper limits on the groupings: 3 6 9 You can enter ">9" into B4 witho...

Email address not created when a new user is created
All, This issue recently happened in my company. Upon creating a new user, the policy was set to create the smtp and X400 address automaticaly. Now when we create a user the smtp and x400 addresses are not created, and when attempting to setup the new user in outlook, the address cant be found. We are using exchange 2003 SP1 on Win2k3 servers. On Wed, 13 Jul 2005 06:49:07 -0700, "Bryan" <Bryan@discussions.microsoft.com> wrote: >All, >This issue recently happened in my company. Upon creating a new user, the >policy was set to create the smtp and X400 addres...

Exchange 2010 MRM, no log files being created
I'm hoping someone can help me with this issue....it has been driving me crazy for days. I have enabled MRM logging on our exchange server, and I can see that some of the policies are working when I run start-managedfolderassistant. We have a retention policy tag on the deleteditems folder, and this does work. The problem is I am not getting any files in the MRM log directory. C:\Program Files\Microsoft\Exchange Server\V14\Logging\Managed Folder Assistant Events 9021 and 9022 are logged in the Application log, but where are the files? Below is the output of my mai...

when form created
I have a form which was created by someone else (not a form template) which is like a questionnaire with empty boxes to be completed. When the boxes are typed in all the margins move to accommodate the words being typed. Is there a way to fix/lock the original form and then just fill in the blank boxes? I suspect this is set up as a table with auto resizing enabled. Displaying table gridlines (Table | Show Gridlines) will help you see what you're dealing with. Then select the table, go to the Table tab of Table Properties, click Options, and clear the check box for "A...

Creating a Brochure
How do you create a 3-column brochure from scratch for Publisher 2002? I can only find the directions for the 2003 version. Quick help would be appreciated, project is due Monday. Create a three-panel or four-panel folded publication http://office.microsoft.com/en-us/assistance/HP011646681033.aspx Scroll down to the section that says "Build a three-panel or four-panel publications from scratch." -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Derek" <Derek@discussions.microsoft.com> wrote in message news...

How to create Access macro shortcut
I'm still using Access 97 and saw something the other day that I would like to use that was in Access 2000. In an Access 2000 database, there was a .mam file in a directory that launched the Access 2000 program and ran a macro. How do you set this up? Can it be done in Access 97? If so, how? Hi. > How do you set this up? Select the macro in the Database Window and right click with your mouse, then select "Create Shortcut..." in the pop-up menu. Follow the prompts for where to place the shortcut and what to name it. The default is: <PathToDeskTopDir>\Shortcut ...

Users mailboxes not created when user created
I have a problem that recently just started happening on my exchange 2003 server. When i create a new user account and create the mailbox for exchange, once im done, the mailbox isnt created, adn if you go into the properties of the user account adn go to the exchange email address tab, there isnt an smtp or an x.400 address listed. I am having to manually create and add these, adn then go delete the exchange mailbox and recreate it. This is really annoying and would love to know if anyone has any ideas of how to fix it. Thanks Jason In news:9F836A43-98BF-435A-AA43-AFF10124BE3F@micro...

CRM should let me create custom fields in batch
Hi, With MS CRM v3.0, when we have a group of fields to create, it would be faster to be able to enter the list and then submit the list for processing. Thank you. Felix. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/C...

Creating an ad book
How do I divide a page into equal sections (halves, qarters, eights)? I need to scan and type ads and coupons into this booklet. New at this. After managing to set up OE-QuoteFix on his new PC, Ed reads a message from FRSH <anonymous@discussions.microsoft.com>... > How do I divide a page into equal sections (halves, qarters, eights)? Arrange > Layout Guides > Grid Guides -- Ed Bennett - MVP Microsoft Publisher http://www.mvps.org/the_nerd/ Before reading this message, view the disclaimer: http://mvps.org/the_nerd/disclaim.htm ...

Access unable to create an MDE
I am getting this message when I try to make an MDE: "Access unable to create an MDE database" No error mesages or any other info is displayed. I haven't had this trouble before. Then I added a form, a couple reports, an create table query, modified a toolbar and added a module. Now I am getting this message. This database is a front end of a project with several linked table to a back end. Any suggestions? Thanks Jeff G Try compiling your application (under the Debug menu when you're in the VB Editor). Often an application will have some error that doesn't m...

create a database from which bibliography an be created
How do I create a database from which a bibliography can be added to the end of a Word document? I used the program RefManager, but that is too expensive for me to update. Does Word 2003 have such a program? Thanks Not natively. Have you checked your academic institution? They might have campus licenses which students can use at home. You could give Zotero a spin (www.zotero.org). Personally, I don't like it, but that's just me. Word 2007 comes with referencing capabilities, but they are limited in functionality. Anything special you want, you would have to add i...

pivot tables #9
i posted this on the general forum but i thought maybe someone here can help me. I have a table that has four regions and total sales amount for each reason by week. my pivot table lists all those and totals it per region per month. i want to add in the pivot table a percentage of the regions sales for that one week over the total sales for all four regions. is there a way i can add that to the table? i.e. the table is currently like this: Week 1 East 500 Midwest 487 South 529 West 492 Total 2008 i want to add the percentages like this: Week 1 East ...

Why do pivot tables not read numbers that are copied and pasted
I am working with a Pivot Table whose information comes from a two columns of data that has been assembled from data copied and pasted from other sheets. Unless I retype all the data, it only shows zeros when sum is selected from field settings. I need a way to get it to sum without retyping or at least to know why it will not sum the numbers. Thanks Excel is seeing the numbers as text. There are some techniques here that you can use to convert the text to numbers, so they can be summed in the pivot table: http://www.contextures.com/xlDataEntry03.html B_4j wrote: > I am worki...

Error creating activities from Cases
Hi I have an out of the box SBS 2003 CRM Setup I have installed Rollup1 and the new help files Under about MS CRM it has CRM 3.0 (3.0.5300.0) When we try and create activies from within a case, we get the following to errors in the event log We can create the activities just fromthe main web client menu ok The same thing happens in the outlook client (OL 2003, Exchange 2003) I found some links to verabose stuff, but they all applied to the have MS CRM setup on multiple server. We have tried it with and without Outlook open Anyhelp appreciated Event Type: Error Event Source: MSC...

date selections from one table to another
Is there a way I can have table1 with only 2 fields (Begin Date) and (End Date) and have a query that asks for all the records from table2 where field (Date of Service) is between (Begin Date) and (End Date) from Table1?? If so, how?? The query won't be updateable but you could try: SELECT Table2.* FROM Table2, Table1 WHERE Table2.[Date Of Service] BETWEEN Table1.[Begin Date] And Table1.[End Date]; -- Duane Hookom Microsoft Access MVP "Schon" wrote: > Is there a way I can have table1 with only 2 fields (Begin Date) and (End > Date) and have...