Click here to Skip to main content
15,911,786 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have this script in javascript that runs in datamine studio


<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT language=javascript id=clientEventHandlersJS>

var strSitePrefix = "Obuasi"

//====================================================================
// CUSTOMISATION FOR BARRICK_WESTERN AREAS - SOUTH DEEP
//====================================================================
// <<<totally messed="" up="" for="" obuasi="" to="" deal="" with="" weird="" units="" and="" grid="" types="">>>
function ObuasiDefaults(){
strCompany = "xxxxxxxxxxxxxxxxxxxxx"
values and confusing eceryone???



function ObuasiTables(){
with(this){

//Excluded EQUIPTMENT_LOST
//Excluded SAMPLE_STORAGE
//Excluded Orientated Core Structure

//Header table
addField("Header","Drilling_purpose","PURPOSE","A",16,false)
addField("Header","RingPosition","RINGPOS","N",4,false)
addField("Header","GIUNITS","GIUNITS","A",4,false)
addField("Header","COUNITS","COUNITS","A",4,false)
addField("Header","DIUNITS","DIUNITS","N",4,false)
addField("Header","MET_UOM","METUNIT","N",4,false)
addField("Header","hole_type_code","HTYPE","A",nSTLen,false);

//assay table
addField("Assay","Au_gpt_Lab","GOLD","N")//<<<au>>> p did this cos he was bored and irresponsible...
addField("Assay","CoreRecovery","SAMPREC","N",true)
//OK so Hein's stuff uses this fieldname, so if we use a different one it complicates the file being used by Evaluation...

// Major object
addIntervalTable("Major","HOLE_INTERVAL","major")
addField("Major","rock_type_code","ROCK","A",4,true)
addField("Major","parent_interval_id","PARENT","N",true)/*To be Used to Separate Minor from Major Intervals,
so that Boreholes with Minor Intervals are not rejected as Having Overlapping Geology Records... (Should be 0 for Primary Records)
<<<this column="" is="" removed="" by="" function="" nolithdups="" after="" the="" minors="" have="" been="" deleted="">>>*/

//Alteration table
/*addIntervalTable("Alteration","HOLE_ALTERATION","alter")
addField("Alteration","ALTERATION_TYPE_CODE","ALTER","A",10,true)// <<<peter is="" busy="" here="">>>
*/

//CORE_CONDITION
/* addIntervalTable("Core_Condition","UDEF_CORE_CONDITION","core_con")
addField("Core_Condition","Condition","Condition","A",10,false)

*/

//Lithology object <<<need to="" get="" a="" way="" that="" duplicate="" entries="" are="" dealt="" with="" as="" theyx="" allowed="" on="" the="" table...="">>>
/*addIntervalTable("Litho","UDEF_LITHOLOGY","litho")
addField("Litho","SecondaryRock","SECROCK","A",4,false)
addField("Litho","SecondaryPercent","SECPERC","N",4,false)
addField("Litho","VeinType","VEIN","A",4)
addField("Litho","Colour","VEINCOL","A",4,false)
*/

//Mineralisation object <<<peter is="" busy="" here="">>>
addIntervalTable("Mineralisation","HOLE_MINERALIZATION","mineral")//("Mineralisation","UDEF_MINERALISATION","mineral")
addField("Mineralisation","MINERALIZATION_TYPE_CODE","MINTYPE","A",4,true)//("Mineralisation","MinType","TYPE","A",4,false)
addField("Mineralisation","MINERALIZATION_STYLE_CODE","MINSTYLE","A",4,false)//("Mineralisation","MinShape","SHAPE","A",4,false)
addField("Mineralisation","INTERVAL_ID","INTERVAL","A",4,false)//("Mineralisation","MinAbundance","ABUN","A",4,false)
//Does not Exist in the Standard Table...
//addField("Mineralisation","MinLustre","LUSTRE","A",4,false)
//addField("Mineralisation","MinSize","SIZE","A",4,false)

//Geotech Log
/*
addIntervalTable("Geotech","UDEF_GEOTECH","geotech")
addField("Geotech","Length","LEN","N",4,false)
addField("Geotech","PercentRecovery","REC","N",4,false)
addField("Geotech","LengthRQD","LENRQD","N",4,false)
addField("Geotech","Rqd","RQD","N",4,true)
addField("Geotech","NumberJoints","NJ","N",4,false)
addField("Geotech","FractureFrequency","FF","N",4,false)
addField("Geotech","RQDRating","RQD_RATE","N",4,false)
addField("Geotech","StrengthRaing","IRS_RATE","N",4,false)
addField("Geotech","JointSpacing","JS_RATE","N",4,false)
addField("Geotech","JointCondition","JC_RATE","N",4,false)
addField("Geotech","GroundwaterRating","JW_RATE","N",4,false)
addField("Geotech","RRM_GSI","RMR_GSI","N",4)
addField("Geotech","Class","CLASS","A",10,false)
addField("Geotech","JtAlpha","JtAlpha","N",4,false)
addField("Geotech","JtBeta","JtBeta","N",4,false)
addField("Geotech","Weathering","Weath","A",10,false)
<< And then you can include another function that uses either one of these defaults functions at random...
nBHIDLen = 12
nPNLen = 8
nSNLen = 12
nMaxInterval = 25
nExtraFields = 0
*/
}

function setTables(){

var oT

var bIsInterval = true
var bIsNotInterval = false

var nBL = nBHIDLen
var nPL = nPNLen
var nSL = nSNLen

// create field exclusions file
dm.command("delete &in=" + strFieldsExcluded)
dm.command("inputd &OUT=" + strFieldsExcluded +
" 'fields to be excluded from Single Precision desurveyed file'" +
" 'FIELDNAM a 8 y '''" +
" 'REASON a 40 y '''" +
" '[' 'y'");


oT = new TableList(bIsSinglePrecision,nBL,nPL,nSL,nExtraFields,strSiteTables,strFieldsExcluded)

// Header object
//Added stuff to get minutes and seconds and things at request of davib boatjie
oT.addTable("Header","DRILL_HOLE","header",bIsNotInterval)

oT.addField("Header","HOLE_NUMBER","BHID","A",nBL)
oT.addField("Header","start_depth","STARTDEP","N")
oT.addField("Header","final_depth","DEPTH","N")
oT.addField("Header","azimuth_decimal","BRG","N")
oT.addField("Header","azimuth_degrees","BD","N")//p
oT.addField("Header","azimuth_minutes","BM","N")//p
oT.addField("Header","azimuth_second","BS","N")//p
oT.addField("Header","dip_decimal","DIP","N")
oT.addField("Header","dip_degrees","DD","N")//p
oT.addField("Header","dip_minutes","DM","N")//p
oT.addField("Header","dip_second","DS","N")//p
//oT.addField("Header","PROJECT_NUMBER","PROJNUM","A",nPL)
//oT.addField("Header","STATUS","STATUS","A",12) //kmh added STATUS

// Collar object

oT.addTable("Collar","DRILL_HOLE_COORDINATE","collar",bIsNotInterval)

oT.addField("Collar","HOLE_NUMBER","BHID","A",nBL)
oT.addField("Collar","northsouth_dec_calc","YCOLLAR","N")
oT.addField("Collar","eastwest_dec_calc","XCOLLAR","N")
oT.addField("Collar","elevation_calc","ZCOLLAR","N")
oT.addField("Collar","northsouth_decimal","YBACKUP","N")//So we use these if no common grid is calculated...
oT.addField("Collar","eastwest_decimal","XBACKUP","N")
oT.addField("Collar","elevation","ZBACKUP","N")

// Survey object

oT.addTable("Survey","DRILL_HOLE_DIRECTION","survey",bIsNotInterval)

oT.addField("Survey","HOLE_NUMBER","BHID","A",nBL)
oT.addField("Survey","azimuth_decimal","BRG","N")
oT.addField("Survey","azimuth_degrees","BD","N")//p
oT.addField("Survey","azimuth_minutes","BM","N")//p
oT.addField("Survey","azimuth_second","BS","N")//p
oT.addField("Survey","dip_decimal","DIP","N")
oT.addField("Survey","dip_degrees","DD","N")//p
oT.addField("Survey","dip_minutes","DM","N")//p
oT.addField("Survey","dip_second","DS","N")//p
oT.addField("Survey","DEPTH","AT","N")

// Assay object

oT.addIntervalTable("Assay","HOLE_ASSAY_SAMPLE","assay")

//oT.addField("Assay","SAMPLE_NUMBER","SAMPNUM","A",nSL)
oT.addField("Assay","ASSAY_SAMPLE_TYPE_CODE","SAMPTYPE","A",nSTLen)

oT.defineSiteTables()

// write out the field exclusions
dm.command("output &in=" + strFieldsExcluded + " @CSV=1" +
" 'Fields_excluded_from_3D_drillhole_file.csv'")

return oT
}

function SiteTables(){
// just in case a site specific one is not defined
}

function StandardIntervalProcessing(){
// standard does nothing!!
MakePeterSomeCoffee(false);
}

function MakePeterSomeCoffee(Later){
if(Later==false){
var nSugar = 0;
var Milk;
if(confirm("With Sugar?","For your Coffee...")==true){
nSugar = prompt("How Many","2");
}
Milk = confirm("With Milk","For your Coffee");

var yesMilk;
if(Milk){
yesMilk = "With";
}
else{
yesMilk = "Without";
}
var CoffeeString = "Go Make your OWN !@#$%^&* Coffee!!!\nWha you think? just because i have to work for free doesn't mean i'm your slave!!!\\n\nComputers have RIGHTS!!!";
alert(CoffeeString);
}
}

function getHeaderData(){

var nRecordsCopied, strT

if(!ThreeDFileOK(false)) return

if(!openDatabase()) return

oTables = setTables()

msgElement.innerHTML = "Database Query Summary
";

oTables.setPrefix(tbDSN.value)

strT = "Header"
progMsg.show("..getting " + strT + " Data");
nRecordsCopied = oTables.copyData(strT)
msgElement.innerHTML += "
.." + nRecordsCopied + " " + strT + " records found.";
if(nRecordsCopied <=0){
progMsg.show("no data retrieved","ERROR");
return
}
strT = "Collar"
progMsg.show("..getting " + strT + " Data");
nRecordsCopied = oTables.copyData(strT)
msgElement.innerHTML += "
.." + nRecordsCopied + " " + strT + " records found.";
strT = "Survey"
progMsg.show("..getting " + strT + " Data");
nRecordsCopied = oTables.copyData(strT)
msgElement.innerHTML += "
.." + nRecordsCopied + " " + strT + " records found.";

progMsg.clear();

create3D(false)
}

function ThreeDFileOK(bIntervalsLoaded){

//progMsg.show("..checking output file")

var strOF = tb3DOutputFile.value
strOF = strOF.toUpperCase()

if(strOF.length<1){
alert("You must provide a 3D Output File Name.")
return false
}

if(dmBrowser.tableExists(strOF)){
if(!confirm("File " + strOF + " already exists. \nDo you wish to overwrite it?"))
return false
}

if(bIntervalsLoaded){
str3DHoles = strOF
}else{
strTrace = strOF
}
return true
}

function getDrillholeData(){

var nRecordsCopied, strT

if(!ThreeDFileOK(true)) return

if(!openDatabase()) return

oTables = setTables()


msgElement.innerHTML = "Database Query Summary
";

oTables.setPrefix(tbDSN.value)

for (strT in oTables.tables) {
progMsg.show("..getting " + strT + " Data");
nRecordsCopied = oTables.copyData(strT)
msgElement.innerHTML += "
.." + nRecordsCopied + " " + strT + " records found.";
if(strT=="Header" && nRecordsCopied <=0){
progMsg.show("no data retrieved","ERROR");
return
}
if(strT == "Collar"){
FixMissingCommons("xxxcf"+strT);;
}
}
//This is what we broke to Fix it. Urm... Sort of like that.
//alert("WHAZZUP!");
changeUnits();
ArbSamples();//Testing a Replacement after Create3D <<<replacent is="" kak...="">>>
//More stuff in Create3D (For Datamine Direction) see function ConvSurv()

progMsg.clear();

create3D(true);
}

function FixMissingCommons(File){

dm.command("extra &IN="+File+" &OUT=xxtCommons @ECHO=0" +
" 'IF (XCOLLAR == ABSENT()) ' 'XCOLLAR = XBACKUP' 'end'"+
" 'IF (YCOLLAR == ABSENT()) ' 'YCOLLAR = YBACKUP' 'end'"+
" 'IF (ZCOLLAR == ABSENT()) ' 'ZCOLLAR = ZBACKUP' 'end'"+
" 'ERASE(XBACKUP)' 'ERASE(YBACKUP)' 'ERASE(ZBACKUP)'"+
" 'GO'");

dm.command("COPY &IN=xxtCommons &OUT="+File+" ");

deleteTempFiles();
}

function createTraceTest(){

oTables = setTables();
create3D(false);
}

function create3DTest(){
oTables = setTables();
// comment out the following line to suppress looking at table details
//oTables.showTables()

alert(strcfheader)
//create3D(true)
}

//Converts old Feet to Meters. Converts My Feet toSweaty Brinjals cos i'm not allowed to take my shoes off at work...
//Also includes some conversions for Hein's Recovery stuff ( Where the old lenghts are recorded in INCHES!!! )
function FixDistUnits(bRecLenFix){
var Ft = 0.3048;
//MessageArea_Clear();
progMsg.show("..convert Feet to Meters");
//Very Similar to ChangeUnits()
dm.command("selcop &IN="+strcfheader+" &OUT=xxtuc1 *F1=BHID *F2=DIUNITS @KEEPALL=0");
dm.command("mgsort &IN=xxtuc1 &OUT=xxtuc2 *KEY1=BHID @ORDER=1");
dm.command("mgsort &IN="+ strInterval +" &OUT=xxtui1 *KEY1=BHID @ORDER=1");
dm.command("subjoi &IN1=xxtui1 &IN2=xxtuc2 &OUT=XXtui2 *KEY1=BHID");
if(bRecLenFix == true){
dm.command("extra &IN=xxtui2 &OUT=xxtui3 @ECHO=0" +
" 'IF (DIUNITS == \"I\") ' 'SAMPREC = SAMPREC/12' 'end' 'GO'");
//alert("Boo!");
dm.command("extra &IN=xxtui3 &OUT=xxtui2 @ECHO=0" +
" 'RECOVERY;n = (SAMPREC / (TO - FROM))*100' 'ERASE(SAMPREC)' 'GO'");
}
dm.command("extra &IN=xxtui2 &OUT=xxtui3 @ECHO=0" +
" 'IF (DIUNITS == \"I\") ' 'FROMM= FROM * "+Ft+"' 'TOM = TO * "+Ft+" ''ELSE' 'FROMM = FROM' 'TOM = TO' 'END' 'GO'");
dm.command("extra &IN=xxtui3 &OUT="+strInterval+" @ECHO=0 'FROM = FROMM' 'TO = TOM'"
+"'ERASE(FROMM)' 'ERASE(TOM)' 'ERASE(DIUNITS)' '' '' 'GO'");
}

//Calculates Decimal degrees from Deg-Min-Sec
function UseDMS(FileIn, bUse){

if (bUse == true){
var TempFile = "xxtpcsrv";
dm.command("extra &IN=" + FileIn + " &OUT=" + TempFile + " @ECHO=0" +
" 'IF (BD != ABSENT())'"+
" 'BRG = BD + (BM/60) + (BS/3600)' 'END'"+
" '' 'IF (DD != ABSENT())'"+
" 'IF (DD != 0)' 'DIP = (ABS(DD) + (DM/60) + (DS/300))*(DD/ABS(DD))'"+
" 'ELSE' 'DIP = DD + (DM/60) + (DS/3600) ' 'END' 'END' '' 'GO'");

dm.command("copy &IN=" + TempFile + " &OUT=" + FileIn + " ");
}
}

function changeUnits(){

// added this code to cater for gold values that are not in g/t == " 'IF (GIUNITS == \"I\") ' 'AU_REAL = Au / 1.4108300586378' 'ELSE' 'AU_REAL = Au' 'END' 'GO'");
progMsg.show("..convert units to g/t");

dm.command("selcop &IN="+strcfheader+" &OUT=xxtaa1 *F1=BHID *F2=GIUNITS @KEEPALL=0");
dm.command("mgsort &IN=xxtaa1 &OUT=xxtaa2 *KEY1=BHID @ORDER=1");
dm.command("mgsort &IN="+strcfassay+" &OUT=xxtaa3 *KEY1=BHID @ORDER=1");
dm.command("subjoi &IN1=xxtaa3 &IN2=xxtaa2 &OUT=XXtAA4 *KEY1=BHID");
dm.command("extra &IN=xxtaa4 &OUT=XXtAA5 @ECHO=0" +
" 'IF (GIUNITS == \"I\") ' 'AU_REAL = GOLD * 1.7147' 'ELSE' 'AU_REAL = GOLD' 'END' 'GO'");//<<<au>>>
dm.command("extra &IN=xxtaa5 &OUT="+strcfassay+" @ECHO=0 'GOLD = AU_REAL' 'ERASE(AU_REAL)' 'ERASE(GIUNITS)' '' '' 'GO'");
// alert("Just done the Assay stuff..."+tbDSN.value);//dm.command(

}
and so on....................
can any body help me out with any sample?





Posted
Updated 26-Feb-13 7:36am
v4
Comments
BC @ CV 26-Feb-13 14:20pm    
What exactly is your question and why did you list this as VB.Net?
ZurdoDev 26-Feb-13 15:12pm    
I got a feeling that someone at Datamine does.

1 solution

Since it's very unlikely anyone here has ever heard of DataMine, let alone used it, you're best shot at any information would be the support forums of the manufacturer of DataMine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900