calling list

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

calling list

Post by SMcClouth »

Hey all,

For a company project I've been asked to write a database gui front end. Due to limitations, such as only being able to use Linux for the server, by the company, I've introduced myself to the world of GAMBAS. Luckily it's very similar to QB and VB. There' only one problem which I have, I need to generate a calling list, which users need to call. I'll try to draw the situation.

user 1 logs in and generates a call list.
user 2 logs in and generates a call list, but it must be unique from the call list of user 1.
user 3 etc.

The issue I have is that at first I tried to randomize a list, but that is a not wishable option. I need to make sure that every user has atleast 150 callers in his/her list but that it doesn't cross other calling list. Then there's possiblity that a caller has to be recalled by the same user.
edit: before I forget, it has to work on the fly; because users login to linux with diffrent accounts, we can't use a local file because than only 1 user can read the file.

I hope someone can help me out with some real or psuedo code because I'm running blank at the moment.

Thanks in advance!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: calling list

Post by burger2227 »

The only way to compare the lists is to have a central file of all names and even then 2 same names could be different people. You might have to compare more than one part of the list data.

To make up data lists QB generally uses a TYPE to hold the name, address, city, state, zip, phone, etc.
A TYPE by definition uses defined length STRINGs. Thus the information is limited such as the name length, etc. RANDOM files are created with a set record byte length so dividing the length into the file size will determine the number of records available. Then just pick any random number up to the size.

Random files could be set up alphabetically, but it would involve creating another file to hold the results of the sort and then write it back to the original. Otherwise to search for a record would mean searching the entire record list until the correct record is found or a new one is added.

Have you considered using QB64 for this project?
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

Re: calling list

Post by SMcClouth »

Burger2227, always a pleasure to hear from you.

The reason why I had to choose for GAMBAS is because SQL. I'm using an SQL-Database, but you did give me some good information to work with. So thanks already for providing me with some clear information!

Grtz
Seb
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: calling list

Post by burger2227 »

Welcome, QB64 can do SQL too.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

Re: calling list

Post by SMcClouth »

We can learn something every day! Thanks again!

grtz
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: calling list

Post by burger2227 »

Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

Re: calling list

Post by SMcClouth »

Back again. I have some PDS-code, I wrote, but it hangs in the FUNCTION unique. Can someone shed me some light on this?

Code: Select all

DECLARE FUNCTION unique! ()
DIM SHARED cid(1500) AS INTEGER         'client id
DIM SHARED cname(1500) AS STRING        'client name
DIM SHARED cnumber(1500) AS STRING      'client phonenumber
DIM SHARED cs AS INTEGER                'all clients
DIM SHARED cc AS INTEGER                'current client

DIM SHARED uid(2) AS INTEGER            'userid
DIM SHARED uname(2) AS STRING           'username
DIM SHARED us AS INTEGER                'all users
DIM SHARED cu AS INTEGER                'current user

DIM SHARED callid(1501) AS INTEGER      'id's from client
DIM SHARED ccmax AS INTEGER             'highest id in call-list
DIM SHARED clarray(10, 150) AS INTEGER  'holds the clientid by
                                        'clarray(call-listid, user)
DIM SHARED used(1501) AS INTEGER        'used clientid's
DIM SHARED clid AS INTEGER              'call-list-id

FOR a = 1 TO 1500
cid(a) = a: cname(a) = "test" + STR$(a): cnumber(a) = "555.1234"
NEXT
cs = a

uid(1) = 1: uname(1) = "tuser1"
uid(2) = 2: uname(2) = "tuser2"
us = 2


FOR a = 1 TO cs
        ccmax = ccmax + 1
        callid(ccmax) = a
NEXT

cuser = 1

FOR a = 1 TO 150
        clarray(a, cuser) = unique
NEXT

FOR clid = 1 TO 6
cc = d2clarry(clid, cuser)
PRINT cc
NEXT
SLEEP


FUNCTION unique
DO
        FOR uniq = 1 TO ccm
                temp = callid(uniq)
                FOR userlist = 1 TO us
                        FOR callids = 1 TO 150
                                IF temp = clarray(userlist, callids) THEN
                                        PRINT temp; " ";
                                        used(temp) = used(temp) + 1
                                END IF
                        NEXT
                NEXT
        NEXT
LOOP UNTIL used(temp) = 1
END FUNCTION

Thx in advance.

Grtz
edit: If necessary, this can be moved to the proper subforum.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: calling list

Post by burger2227 »

FOR loops never execute if they are formatted incorrectly. If the start value is greater than the stop value then the FOR statement must have a minus STEP value to run. Those main program values are not passed to SUB procedures.

Code: Select all

FUNCTION unique
DO
    FOR uniq = 1 TO ccm 'if ccm = 0 then FOR loop is never executed
        temp = callid(uniq)
           FOR userlist = 1 TO us 'if us = 0 then FOR loop is never executed
                FOR callids = 1 TO 150
                      IF temp = clarray(userlist, callids) THEN
                             PRINT temp; " ";
                             used(temp) = used(temp) + 1 'if any loop is skipped, this is never executed
                      END IF
                 NEXT
           NEXT
     NEXT
LOOP UNTIL used(temp) = 1 ' if used(temp) = used(temp) + 1 is never executed, this never happens
END FUNCTION
Independent FUNCTION procedures cannot read values from the main program module so they must be defined internally or passed through parameters to the function:

FUNCTION unique (ccm, us)
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

Re: calling list

Post by SMcClouth »

Hi Burger2227,

Thx for your insight. This gives me again something to work with.

Best wishes for the new year!

Grtz
Post Reply