i dont think u can add columns using modify... there are various ways to achieve what u want... i mean, i need to know exactly what u want to do... what i understand is u want to create a dynamic DW...
IF Len(error_syntaxfromSQL) > 0 THEN
// Display errors
mle_sfs.Text = error_syntaxfromSQL
ELSE
// Generate new DataWindow
dw_new.Create(new_syntax, error_create)
IF Len(error_create) > 0 THEN
mle_create.Text = error_create
END IF
END IF
dw_new.SetTransObject(SQLCA)
dw_new.Retrieve()
//Check the above example and tell me what u want exactly... will help u achieve what u want...
Are you creating datawindow dynamically or creating in column dynamically in existing datawindow ?
If datawindow is already there and all required columns are selected in it's syntax but not painted in datawindow, then what you need is Modify function. And best is first place one column in datawindow and designtime, check the datasource of that datawindow, copy the syntax of that column, remove column from datawindow and use modify function runtime to create column.
Unfortunately, the data does not exist in the database the way that I need it and I do not think it is possible to use SyntaxFromSQL. I have to many functions that loop through all of the tables and do special logic.
Sandeep,
Thanks for your note. I think this is arduous, but I understand where you are headed. Can I put that code in a for next loop and add the columns interatively? Or do I have to assembe one giant string and then write it out once?
I will try adding your code into a for next loop for now as I want to work with smaller chuncks of the string.
Thank you, gentlemen.
Paul
0
pemurrayAuthor Commented:
All,
Okay, here is what I have and what I did.
I created a datawindows with one column.
I deleted the column.
I added 48 computed columns.
Ideally, I would simply make the expression in the each of the computed columns: gridarray(getcolumn(),getrow())
Then I would be done. But I cannot figure out how to do that so now I am trying to add columns dynamically with the values in my array.
Sandeep, I added your code and ran the program. I put in a messagebox to see the string that dwModify returned. The string was null.
Then I looked at the datawindow, but I did not see any NEW columns. I am perplexed.
***INSERT NEW ROWS AND CHANGE THE VALUE OF EACH ROW IN EACH COLUMN
***IN THE CODE BELOW, I JUST WANT TO WRITE OUT THE TIME (E.G., 14:15:00) IN THE FIRST COLUMN
//NOW INSERT THE ROWS INTO DW_1 - 48 rows = 12 hours
for i = 1 to 48
newrow = dw_1.insertrow(0)
setitemresult = dw_1.setitem(newrow,1,currenttimebucket)
pu_time_bucket = time(currenttimebucket)
pu_time_bucket = Relativetime(pu_time_bucket, 900)
currenttimebucket = string(pu_time_bucket)
next
0
pemurrayAuthor Commented:
Gentlemen,
I am closing this out.
I came across Bhatti's suggestion to use an External Datawindow in grid format that allows you to simply make invisible the fields that you don't want.
I am hoping that I won't run into any roadblocks, but I have already tried it out a bit and it seems to be a clean way to do it.
Both of your answers could work, so I am splitting the points.
Thank you,
Paul
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
i dont think u can add columns using modify... there are various ways to achieve what u want... i mean, i need to know exactly what u want to do... what i understand is u want to create a dynamic DW...
just check this PB example from the Help...
string error_syntaxfromSQL, error_create
string new_sql, new_syntax
new_sql = 'SELECT emp_data.emp_id, ' &
+ 'emp_data.emp_name ' &
+ 'from emp_data ' &
+ 'WHERE emp_data.emp_salary>45000'
new_syntax = SQLCA.SyntaxFromSQL(new_sq
'Style(Type=Grid)', error_syntaxfromSQL)
IF Len(error_syntaxfromSQL) > 0 THEN
// Display errors
mle_sfs.Text = error_syntaxfromSQL
ELSE
// Generate new DataWindow
dw_new.Create(new_syntax, error_create)
IF Len(error_create) > 0 THEN
mle_create.Text = error_create
END IF
END IF
dw_new.SetTransObject(SQLC
dw_new.Retrieve()
//Check the above example and tell me what u want exactly... will help u achieve what u want...
Cheers,
Rosh