I open up a module, save the existing columns, delete these columns, perform some filtering activity, then turn the filter and want to restore the original columns.
strNewLine = "\n"
strBlank = ""
const int nTestStatus = 0
const int nOriginalColumns = 0
Column gColumnToModify = null
string strColorAttr = "null"
string strTS = "Test Status"
string strTC = "Test Comment"
bool bColumnFound = false
Module m = current
AttrDef ad
int nColumnToDeleteAndAddBack
Column Original[20]
const string strOriginalColumnTitle[] = {"","","","","","","","","","","","","","","","","","","",""} // 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
const string strOriginalColor[] = {"","","","","","","","","","","","","","","","","","","",""} // 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
int nMainColumn
const int MAX_COLUMNS = 4
const string strColumnTitle[] = {"Base ID","VV Test Identifier","",strTC} // 0,1,2,3
void OriginalColumns()
{
int nCount = 0
Column col
for ad in m do
{
if ((ad.object) && (!ad.system))
{
col = column (nCount)
if (main(col))
nMainColumn = nCount
Original[nCount] = col
strOriginalColumnTitle[nCount] = title(col)
strOriginalColor[nCount] = color(col)
nCount++
} // end if ((ad.object) && (!ad.system))
} // end for ad in m do
int nLoop
for (nLoop = 0; nLoop < nCount; nLoop++)
{
if (strOriginalColumnTitle[nLoop] != strBlank)
{
//print "Column " Original[nLoop] strNewLine
// print "Title " strOriginalColumnTitle[nLoop] strNewLine
// print "Color " strOriginalColor[nLoop] strNewLine
// print strNewLine
nOriginalColumns = nLoop
} // end if (strOriginalColumnTitle != strBlank)
} // end for (int nLoop = 0; nLoop < nCount; nLoop++)
} // OriginalColumns()
void DeleteOriginalColumns()
{
int n = 0 // number of existing columns
int i // column index
Column c
for c in current Module do
n++ // count the columns
// delete n column 0s
for i in 1:n do
{
delete column 0
} // end for i in 1:n do
} //DeleteOriginalColumns()
void ReplaceOriginalColumns()
{
int nLoop
print "Original Columns " nOriginalColumns strNewLine
for (nLoop = 0; nLoop < nOriginalColumns; nLoop++)
{
//Column col = Original[nLoop]
Column col
string strTitle = strOriginalColumnTitle[nLoop]
string strColor = strOriginalColor[nLoop]
col = insert (column nLoop)
if (nLoop == nMainColumn)
main(col)
attribute(col, strTitle)
// Copy the column color, if it exists
if( !null strColor )
{
color( col, strColor)
} // end if( !null strColorAttr )
width(col, 100)
} // end for (nLoop = 0; nLoop < nOriginalColumns; nLoop++)
} //ReplaceOriginalColumns()
pragma runLim, 0 //disables the "Execution Timeout" dialog
OriginalColumns
DeleteOriginalColumns
ReplaceOriginalColumns
Gedinfo - Fri May 18 09:18:44 EDT 2012 |
Re: How to insert a main column
|
Re: How to insert a main column
I have removed the attribute for main.
void ReplaceOriginalColumns()
{
int nLoop
print "Original Columns " nOriginalColumns strNewLine
for (nLoop = 0; nLoop < nOriginalColumns; nLoop++)
{
//Column col = Original[nLoop]
Column col
string strTitle = strOriginalColumnTitle[nLoop]
string strColor = strOriginalColor[nLoop]
col = insert (column nLoop)
if (nLoop != nMainColumn)
attribute(col, strTitle)
// Copy the column color, if it exists
if( !null strColor )
{
color( col, strColor)
} // end if( !null strColorAttr )
width(col, 100)
} // end for (nLoop = 0; nLoop < nOriginalColumns; nLoop++)
} //ReplaceOriginalColumns()
|
Re: How to insert a main column
Second, you will need to ignore or replicate Layout columns. I think this may get you going:
Third, what's the point? Just do your filter. If you must do this, then if the view does not remember the filter then just apply your filter and re-load the view. -Louie |
Re: How to insert a main column Each team member has set up views that are not always how the spreadsheet expects, therefore, I save the existing columns, delete them, display required columns, export to spreadsheet, then delete the required, and redisplay the view. |
Re: How to insert a main column Gedinfo - Fri May 18 12:28:10 EDT 2012 Would it not just be easier to define such an export-view and have your script load it, along with its filter? Then you load the view and exort. That just has to be superior to hard-coding all that info in a script. -Louie |