I've created an autonaming function that is invoked when the user saves a dcr. When the user saves the file for the first time, it names the dcr and then saves it in the root data directory. I've been trying to find a way for the dcr to be saved in the directory the user was in when they started the new form. I can't seem to find a methood that does that.IWDatacapture.getDCRPath () returns an empty string when the dcr is new. Is there anything to get the current directory path?// Autonaming the DCR on click of a save buttonfunction autoName() { var dcrName = IWDatacapture.getItem("/title").getValue(); var VPath = IWDCRInfo.getDCRName(); if (VPath == "" && dcrName != "") { IWDCRInfo.setDCRName(dcrName); } return true;}
You may perhaps extract this information from _iwdcWin.location attribute. It's a hack though so no documentation and no support
You can try the following to get DCR path:$dir_path=iwpt_get_dcr_name();iwpt_output("The DCR is located at : '$dir_path'");you will be getting the path where the DCR is located at.Venkat.
On the project I'm working on right now - we added a "Location" select list on the DCT - that's populated by an inline script which looks for all existing sub-directories beneath the /data/ directory - and we pass that value as one of the parameters to the callServer script to do the auto-naming - quick, not too dirty, and certainly supported....