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

Access the Current File object Empty Access the Current File object

Thu 20 Dec 2018 - 16:01
Original post by Mike Vaughan

Hi, I have a Taskflow Action that calls a Wizard that captures values which in turn are input into a Precedent. The wizard is not bound to any sql table.

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;

On the Wizard UDWZLBA I need to access the Current File object to access some extended data on the File. This data is then used so set defaults for the controls on the Wizard. I have tried this code...

Code:
FWBS.OMS.OMSFile _currentfile = EnquiryForm.Enquiry.Object as FWBS.OMS.OMSFile

but the _currentfile object is NULL. 

I'm not sure what I need to do to get this to work such as registering the Wizard or using the Data Builder to get the FileID and then assign this to the _currentfile.FileNo?

Any help on this will be great (do you have any Precedent Wizard documentation?)
Thanks

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Mike Walker

There is a Session.CurrentFile object that is the last used File on the system. not _currentfile. FWBS.OMS.

Code:
FWBS.OMS.OMSFile _currentfile = FWBS.OMS.Session.CurrentSession.CurrentFile;

Regards
M

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Graham Shaw

Hi, Just a word of warning, we used to reference CurrentFile, but found on occaisions it was Null (well nothing as we use VB ;o)

We now always pass in the ID in the keys collection of the wizard and use the shared GetFile on the FWBS.OMS.OMSFile object and then use the returned file rather than currentfile

G

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Mike Walker

You should always check Objects aren't null (Nothing if VB Wink) CurrentFile is a moving goal post so when you use System methods like GetFile this will set the CurrentFile object but again, to be really sure you may wish to Pass ID and re fetch the file object, this doesn't go back to the database if it is in the working cache.

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

Access the Current File object Empty Re: Access the Current File object

Thu 20 Dec 2018 - 16:04
Original post by Mike Vaughan

In this instance using CurrentSession.CurrentFile has worked, but if it sometimes returns a Null I think we’d rather pass in the Current File ID from the taskflow to the Wizard. 

Am I correct in thinking you use pass in the FileID to the FWBS.Common.KeyValueCollection _kvc object to the wizard? 

_kvc.Add(“FileID”, CurrentFile.FileNo); ??

If this is correct how do I then make reference to the KVC FileID in the Wizard script?

thanks

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Mike Walker

You should use the File object you have in memory if not CurrentFile and then use the ID Property on the OMSFile object as this is the unique key. 
Regards

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Graham Shaw

Hi Mike

Either have a control (we tend to use component) and set its default value to be the name of the key in the key value collection or use the ReplacementParameters kv collection to get the value you sent in
G
Back to top
Permissions in this forum:
You cannot reply to topics in this forum