Jump to content

Array Display $sHeader issue


Adamguy
 Share

Recommended Posts

Hi All

I'm having difficulties with my Array. i have it reading an excel .csv  and i have set the $iFlags to 65 (64, 1). the issue is that my headings show up as the set default "Col 0 | Col 1 | ..."

if i was to set the $sflags to 0 my headings are fine but it displays the data incorrectly, can someone please help me or link me to some helpful information about this, i cant seem to find anything that suits my needs, or even an alternative, I'm kind of a newbie to Auto i.t and my intention is to create a Gui that reads a spread sheet and displays the data.

 

thanks!

Adam

 

code attached.

project.au3

Link to comment
Share on other sites

#include <File.au3>
#include <Excel.au3>
#include<MsgBoxConstants.au3>
#Include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

 

Local $bVisible = True
local $Spreadsheetlocation = "C:\spreadsheet location
Local $oExcel = _excel_open($bVisible = False)
Local $oWorkBook = _Excel_BookOpen ( $oExcel, $Spreadsheetlocation)

$aArray = $oExcel.Activesheet.Range("A:D").Value


#include <Array.au3>
local $heading = "Job Title | AffectedUser | Description | DateCreated "
Local $iflags = 65
_ArrayDisplay ( $aArray ,"Jobs Logged" ,"|3" , $iflags ,Default , $heading , Default , Default, Default)

 

 

code -

Link to comment
Share on other sites

  • Moderators

Adamguy,

Welcome to the AutoIt forums.

The problem is caused by you transposing the array as you display it. The internal logic of the UDF says that if you transpose the array then the columns are now rows and so the headers are no longer required. So you need to transpose your array before you display it:

#include <Array.au3>

Global $aArray[][] = [["Title 1", "Title 2", "Title 3", "Title 4"], _
        ["User 1", "User 2", "User 3", "User 4"], _
        ["Descript 1", "Descript 2", "Descript 3", "Descript 4"]]

Local $heading = "Job Title | AffectedUser | Description | DateCreated "
Local $iflags = 64 ; Do not add the transpose flag here

_ArrayTranspose($aArray)

_ArrayDisplay($aArray, "Jobs Logged", Default, $iflags, Default, $heading)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 12/11/2017 at 0:27 AM, Melba23 said:

Adamguy,

Welcome to the AutoIt forums.

The problem is caused by you transposing the array as you display it. The internal logic of the UDF says that if you transpose the array then the columns are now rows and so the headers are no longer required. So you need to transpose your array before you display it:

#include <Array.au3>

Global $aArray[][] = [["Title 1", "Title 2", "Title 3", "Title 4"], _
        ["User 1", "User 2", "User 3", "User 4"], _
        ["Descript 1", "Descript 2", "Descript 3", "Descript 4"]]

Local $heading = "Job Title | AffectedUser | Description | DateCreated "
Local $iflags = 64 ; Do not add the transpose flag here

_ArrayTranspose($aArray)

_ArrayDisplay($aArray, "Jobs Logged", Default, $iflags, Default, $heading)

M23

thanks so much, know what im doing now!! :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...