Jump to content

Recommended Posts

Posted

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

Posted

#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 -

  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted
  On 12/10/2017 at 1:27 PM, 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

Expand  

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

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
  • Recently Browsing   0 members

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