Alpha Video Training
Results 1 to 3 of 3

Thread: Guidance on how to columnize my Array display

  1. #1
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    785

    Default Guidance on how to columnize my Array display

    I have only ever used Browses, Forms and Reports to display my data, so what do I have to learn to get the columns in an array display to list properly?
    Everything lines up when I use a mono spaced font, but when I try and use others the columns become zig-zagged.

    following code segments from my script:

    Code:
    {font=Lucida Sans Typewriter,9}
    Code:
    [%O==FmtMissingLog(eval(value))%.80,8mix^#vMissingData]{endregion}
    Code:
    [%O==FmtCurrLogg(eval(value))%.160,24idx^#vDisplayData!select_*];

    Code:
    FUNCTION FmtMissingLog as c (ar as p)
        if chr(123) $ ar.where then
            vWhere = stritran(ar.where,chr(123),"")
            vWhere = stritran(vWhere,chr(125)," ott")
        else
            vWhere = ar.where
        end if
        fmtMissingLog  = padr(ar.reg,9," ")+padr(ar.Code,8," ")+padr(ar.H,3," ")+padr(ar.When,11," ")+padr(vWhere,34," ")
    end function
    your guidance respectfully requested.

    Code:
    FUNCTION FmtCurrLogg as c (ar as p)
        if chr(123) $ ar.where then
            vWhere = stritran(ar.where,chr(123),"")
            vWhere = stritran(vWhere,chr(125)," ott")
        else
            vWhere = ar.where
        end if
        if rtrim(ar.as) <> "" then
            vReg = ar.reg
        else
            vReg = ar.reg
        end if
        if isdate(dtoc(ar.when)) then
            vWhen = dtoc(ar.when)
        else
            vWhen = " "
        end if
        if rtrim(ar.ac_unique) = "" then
            vAcType = ""
        else
            vActype = lookupc("f",ar.ac_unique,"aircraft_type","aircraft_type","Ac_Unique")
        end if
        if rtrim(ar.country) = "" then
            vCountry = " "
        else
            vCountry = rtrim(ar.country)
        end if
        FmtCurrLogg = padr(ar.reg,9," ")+padr(ar.Code,8," ")+padr(ar.H,3," ")+padr(vWhen,11," ")+padr(vWhere,28," ")+padr(vAcType,32," ")+vCountry
    end function
    I think I may need to add something between the two == and possible more formatting in the two functions, but what?
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  2. #2
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    785

    Default Re: Guidance on how to columnize my Array display

    More sample code.
    It seems I can only add background colour, surely there must be a way to set the columns properly?

    Code:
    dim shared vFilterTxt as c = <<%a%
    (reg='06 blue'.and.country='RUSSIANFEDER').or.(reg='07 black'.and.country='RUSSIANFEDER').or.(reg='08 red'.and.country='RUSSIANFEDER').or.(reg='200'.and.country='FRANCE').or.(reg='WZ755'.and.country='UK').or.reg='C-GBKF'.or.reg='D-EEFV'
    %a%
    dim vOrder as c = "REG"
    dim idx1 as n
    dim vDisplayData1[9] as p
    vDisplayData1.initialize_from_table("Logging",vFilterTxt,vOrder)
    vDisplayData1.sort("A","REG")
    ui_dlg_box("",<<%dlg%
    {Background=#153+204+255}
    {removeComments}
    {region}
    '''''''''{font=Lucida Sans,8}
    '''''''{font=Lucida Sans Typewriter,8}
    {font=Courier New,8}
    {region}
    [%O==FmtCurrLogg(eval(value))%.170,12idx1^#vDisplayData1];
    {endregion};
    {region}
    <Close!Close>
    {endregion}
    %dlg%)
    FUNCTION FmtCurrLogg as c (ar as p)
    	if rtrim(ar.as) = "" then
    		vAsSeen  = ""
    		fmt = "{b=light green}"
    	else
    		vAsSeen = "("-ar.as-")"
    		fmt = "{b=gold}"
    	end if
    	if chr(123) $ ar.where then
    		vWhere = stritran(ar.where,chr(123),"")
    		vWhere = stritran(vWhere,chr(125)," ott")
    	else
    		vWhere = ar.where
    	end if
    	if isdate(dtoc(ar.when)) then
    		vWhen = dtoc(ar.when)
    	else
    		vWhen = ""
    	end if
    	if rtrim(ar.ac_unique) = "" then
    		vAcType = ""
    	else
    		vActype = lookupc("f",ar.ac_unique,"aircraft_type","aircraft_type","Ac_Unique")
    	end if
    	if rtrim(ar.country) = "" then
    		vCountry = ""
    	else
    		vCountry = rtrim(ar.country)
    	end if
    	FmtCurrLogg = fmt+padr(ar.reg,9,".")+padr(ar.Code,8,".")+padr(ar.H,3,".")+padr(vWhen,11,".")+padr(vWhere,28,".")+padr(vAsSeen,12,".")+padr(rtrim(vAcType),32,".")+vCountry
    end function
    I have attached two screen shots, one using a monospaced font and the other a proportional font.

    how do I get the columns aligned with a proportional font?
    Attached Images Attached Images
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  3. #3
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    785

    Default Re: Guidance on how to columnize my Array display

    Finally stumbled onto the solution:

    Code:
    ui_dlg_box("",<<%dlg%
    {Background=#153+204+255}
    {removeComments}
    {units=F}
    {region}
    {font=COURIER NEW,9}
    {region}
    [%O==FmtCurrLogg(eval(value))%.170,12idx1^#vDisplayData1];
    {endregion};
    {region}
    <Close!Close>
    {endregion}
    %dlg%)
    end
    FUNCTION FmtCurrLogg as c (ar as p)
    	tab1 = "{T=0}"
    	tab2 = "{T=0.6}"
    	tab3 = "{T=1.1}"
    	tab4 = "{T=1.3}"
    	tab5 = "{T=2.2}"
    	tab6 = "{T=3.6}"
    	tab7 = "{T=4.5}"
    	tab8 = "{T=7}"
    	if rtrim(ar.as) = "" then
    		vAsSeen  = ""
    		fmt = "{b=light green,Dark Green}"
    	else
    		vAsSeen = "("-ar.as-")"
    		fmt = "{b=gold,Red}"
    	end if
    	if chr(123) $ ar.where then
    		vWhere = stritran(ar.where,chr(123),"")
    		vWhere = stritran(vWhere,chr(125)," ott")
    	else
    		vWhere = ar.where
    	end if
    	if isdate(dtoc(ar.when)) then
    		vWhen = dtoc(ar.when)
    	else
    		vWhen = ""
    	end if
    	if rtrim(ar.ac_unique) = "" then
    		vAcType = ""
    	else
    		vActype = lookupc("f",ar.ac_unique,"aircraft_type","aircraft_type","Ac_Unique")
    	end if
    	if rtrim(ar.country) = "" then
    		vCountry = ""
    	else
    		vCountry = rtrim(ar.country)
    	end if
    	FmtCurrLogg = fmt+tab1+ar.reg+tab2+ar.Code+tab3+ar.H+tab4+vWhen+tab5+vWhere+tab6+vAsSeen+tab7+vAcType+tab8+vCountry
    end function
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

Similar Threads

  1. dont understand how to display an array
    By Graham Wickens in forum Alpha Five Version 11 - Desktop Applications
    Replies: 3
    Last Post: 03-06-2019, 04:17 PM
  2. Sorting One Array Based on Values in another Array
    By G Gabriel in forum Alpha Five Version 11 - Desktop Applications
    Replies: 24
    Last Post: 03-11-2014, 10:40 AM
  3. sql_get_value --> split results into Display / Value array
    By pettechservices in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 05-19-2012, 12:32 AM
  4. Array Question -will a multi-dimension array solve my problem?
    By djldc in forum Alpha Five Version 10 - Desktop Applications
    Replies: 11
    Last Post: 08-08-2011, 10:23 PM
  5. How do I display the number of non-empty elements in an Array
    By Graham Wickens in forum Alpha Five Version 7
    Replies: 2
    Last Post: 01-11-2007, 03:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •