Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Unbound Precedent Wizard Empty Unbound Precedent Wizard

Thu 20 Dec 2018 - 15:47
Original post by Mike Vaughan

Hi,I'm having some trouble with an unbound Precedent Wizard that prompts the user for data which is then input into a precedent. (This data is not saved anywhere).I use the following code to call the Wizard and get the data...

Code:
FWBS.Common.KeyValueCollection _kvc = new FWBS.Common.KeyValueCollection();
System.Data.DataTable _result =
    FWBS.OMS.UI.Windows.Services.Wizards.GetWizard("UDWZLBA",
        CurrentFile ,FWBS.OMS.EnquiryEngine.EnquiryMode.Add,
        _kvc) as System.Data.DataTable;

When I pass in the Column Name to the Data Table using this code, _result.Rows[0][“NilValue”] I get the following error...

message.SystemArgumentException: Column "NilValue" does not belong to table DATA

But when I pass in the numerical index of the Column like this, _result.Rows[0][1], The data is returned.

I think it must be something to do with the Wizard I have created but I'm not sure where I'm going wrong. The check box control cbxNilValue has the "FieldName" and "Property" properties set to "NilValue". 

I've tried other controls and I get the same result. What do I need to do to enable me to use the Column name and not the index?
thanks

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Darren Baldwin

Hi Mike, Without getting into the specifics of your issue here if you have a DataTable and you are unsure which columns it contains it may help just to run it with a little helper method inside to output the column names.

Code:
string[] colNames = new string[_result.Columns.Count];
for (int i = 0; i < _result.Columns.Count; i++)
{
    colNames[i] = _result.Columns[i].ColumnName;
}

System.Windows.Forms.MessageBox.Show(string.Join(",", colNames));
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Unbound Precedent Wizard Empty Re: Unbound Precedent Wizard

Thu 20 Dec 2018 - 15:48
Original post by Mike Vaughan

Hi, I've actually just fixed this now and your code confirmed this. when the DataTable is created it gives the column names the same name as the Control.

So instead of looking up "NilValue" I used "cbxNilValue" and it now returns the value.thanks for your help.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum