Error: Compile Error: expecting a colon, found 'vInvReq.JDRF_Location__c' at line 16 column 13 - apex-code

I am getting this error while compiling this trigger,
Error: Compile Error: expecting a colon, found 'vInvReq.JDRF_Location__c' at line 16 column 13
My code below, problem is with this line WHERE Name=vInvReq.JDRF_Location__c]);
Thanks and appreciate any help,
trigger TgrInventoryRequestAfter on Inventory_Request__c (after update) {
//set<Id> JDRFLocationId = new set<Id>();
//List<Inventory_Request__c> vLstInventory_Request= new List<Inventory_Request__c>();
List<JDRF_Location__c> locaList = new list<JDRF_Location__c>();
for (Inventory_Request__c vInvReq:trigger.new)
{
if(vInvReq.Request_Status__c == 'Approved' && vInvReq.Inventory_Type__c == 'Bag of Hope')
{
locaList=
new list<JDRF_Location__c> ([Select Name,Current_boh_Inventory__c from JDRF_Location__c
WHERE Name=vInvReq.JDRF_Location__c]);
Integer sumCBOH = vInvReq.Units_Requested__c+ locaList.Current_boh_Inventory__c ;
locaList.Current_boh_Inventory__c= sumCBOH;
}
}

Put =: after WHERE in between the field name and the variable:
WHERE Name=:vInvReq.JDRF_Location__c
Here is why:
https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_variables.htm

Related

Wordcount Nonetype error pyspark-

I am trying to do some text analysis:
def cleaning_text(sentence):
sentence=sentence.lower()
sentence=re.sub('\'','',sentence.strip())
sentence=re.sub('^\d+\/\d+|\s\d+\/\d+|\d+\-\d+\-\d+|\d+\-\w+\-\d+\s\d+\:\d+|\d+\-\w+\-\d+|\d+\/\d+\/\d+\s\d+\:\d+',' ',sentence.strip())# dates removed
sentence=re.sub(r'(.)(\/)(.)',r'\1\3',sentence.strip())
sentence=re.sub("(.*?\//)|(.*?\\\\)|(.*?\\\)|(.*?\/)",' ',sentence.strip())
sentence=re.sub('^\d+','',sentence.strip())
sentence = re.sub('[%s]' % re.escape(string.punctuation),'',sentence.strip())
cleaned=' '.join([w for w in sentence.split() if not len(w)<2 and w not in ('no', 'sc','ln') ])
cleaned=cleaned.strip()
if(len(cleaned)<=1):
return "NA"
else:
return cleaned
org_val=udf(cleaning_text,StringType())
df_new =df.withColumn("cleaned_short_desc", org_val(df["symptom_short_description_"]))
df_new =df_new.withColumn("cleaned_long_desc", org_val(df_new["long_description"]))
longWordsDF = (df_new.select(explode(split('cleaned_long_desc',' ')).alias('word'))
longWordsDF.count()
I get the following error.
File "<stdin>", line 2, in cleaning_text
AttributeError: 'NoneType' object has no attribute 'lower'
I want to perform word counts but any kind of aggregation function is giving me an error.
I tried following things:
sentence=sentence.encode("ascii", "ignore")
Added this statement in the cleaning_text function
df.dropna()
Its still giving the same issue, I do not know how to resolve this issue.
It looks like you have null values in some columns. Add an if at the beginning of cleaning_text function and the error will disappear:
if sentence is None:
return "NA"

Facing issues in compilation of idl files using tao_idl in rhel7 machine

i am facing issues in compilation of idl file. i have tried with different options with -Cw, -GI and -o all are giving the below errors
tao_idl: "El_file.idl", line 201: error in lookup of symbols File::File1_operationFailed
tao_idl: "El_file.idl", line 204: error in lookup of symbols File::File1_operationFailed
tao_idl: "El_file.idl", line 208: error in lookup of symbols File::File1_operationFailed
tao_idl: El_file.idl: found 744 errors
Fatal Error - Aborting
Thanks for response john.
line 9 : statement cannot be parsed
line 201: error in lookup of symbol: ptype
line 9 :module Mgr{
interface intf1;
interface intf2;
interface intf3;
....
..
...
...
..
}
enum ptype{
Profile1,
Profile2,
...
...
}
line 201 :struct pstruct{
ptype P1;
}
Your IDL is not legal, you should close the module, enum, and struct with }; and not just }

Error translating mvel script to groovy

While preparing for an update to elasticsearch 2.0, I noticed mvel scripting is being deprecated in favor of groovy. My problem is that I am new to groovy and don't know how to fix this error.
boolean engineTest = false; if (!engineTest) { engineTest = true;} return engineTest;
This throws the following error
unexpected token: return # line 1, column 68. [...]
If it all needs to be on 1 line, then you're missing a semi-colon before the return statement. As in:
​boolean engineTest = false; if (!engineTest) { engineTest = true}; return engineTest;​
Otherwise, you could split the statements on 3 lines and avoid all semi-colons.

Why does this warning testCase return an error?

I have written the following validation Rule:
#Check
def checkDeclarationIsNotReferenceToItself(Declaration dec) {
if(dec.decCon.singleContent.reference == null && !dec.decCon.nextCon.isEmpty) {
//only proceed if it is a reference
return
}
var name = dec.name
if(dec.decCon.singleContent.reference.name == name) {
//only if the declaration is a self-reference without further actions
var warningMsg = "The declaration '" + name + "' is a reference to itself"
warning(warningMsg,
SQFPackage.eINSTANCE.declaration_DecCon,
SELFREFERENCE)
}
}
And then I have written an test case for it looking as following:
#Test
def void checkDeclarationIsNotReferenceToItselfTest() {
'''
test = 3;
test = test;
'''.parse.assertWarning(SQFPackage.eINSTANCE.decContent,
SQFValidator.SELFREFERENCE,
"The declaration 'test' is a reference to itself")
}
But when I run JUnit it reports an error:
Expected WARNING 'raven.sqf.SelfReference' on DecContent at [-1:-1] but got
WARNING (raven.sqf.SelfReference) 'The declaration 'test' is a reference to itself' on Declaration, offset 18, length 4
I don't understand this because it actually expects exactly that error message (As far as I see it)
Anyone has an idea why it doesn't work?
Greetings Krzmbrzl
looks like the way you create the warning and test the validation do not match together
warning(warningMsg,
SQFPackage.eINSTANCE.declaration_DecCon,
SELFREFERENCE)
creates the warning on a Declaration
.assertWarning(SQFPackage.eINSTANCE.decContent,
SQFValidator.SELFREFERENCE,
"The declaration 'test' is a reference to itself")
tests for a DecContent

DBD::Oracle::st execute failed: system generated message

For oracle system generated Software Error messages during prepare/execute query invalid. displays complete query to user on a webpage. want to replace system generated message with user common message.
example:
Software error:
DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR: error possibly near <> indicator at char 136 in 'SELECT EQUIPID, EQUIPSHORTNAME, MAXLIMITEDDAYS, STATUS, EQUIPNAME FROM LAB_EQUIPMENT_DETAILS WHERE CATEGORYID = '3' AND SUBCATEGORYID = <>' ' AND STATUS != 'DELETE'') [for Statement "SELECT EQUIPID, EQUIPSHORTNAME, MAXLIMITEDDAYS, STATUS, EQUIPNAME FROM LAB_EQUIPMENT_DETAILS WHERE CATEGORYID = '3' AND SUBCATEGORYID = '****' AND STATUS != 'DELETE'"] at /proj/aa/bb/Source/Global_Routines_general_apps.pm line 126.
For help, please send mail to the webmaster ([...]), giving this error message and the time and date of the error.
Can anyone please help me in doing this.
Thanks in advance.
Simply wrap your execute statement in an eval block and catch the error.
eval {
$sth->execute();
...
};
if ( $# ) {
# log the full error message
write_log( $sth->errstr );
# and re-throw the common message
die 'HEY!!!! Something is messed up here!';
}

Resources