「nitpick」 = 些細な指摘(重箱の隅をつつくの意味)
[Technical terms]LGTM
「Looks Good To Me」 = 良いと思います
[Salesforce]Only variable references are allowed in dynamic SOQL/SOSL
エラー:Only variable references are allowed in dynamic SOQL/SOSL
・エラーが起きるケース
List<String> accountIdList = new List<String>();
for(Account account : accountList){
accountIdList.add(account.Id);
}
String query = '';
query = '';
query += ' SELECT Id ';
query += ' , Name ';
query += ' , Account__c ';
query += ' , Account__r.Id ';
query += ' From Test__c ';
query += ' WHERE Account__r.Id IN : \'' + accountIdList + '\'';
system.debug('query:'+query);
List<Test__c> testLsit = Database.query(query);
・エラーが起きないケース
List<String> accountIdList = new List<String>();
for(Account account : accountList){
accountIdList.add(account.Id);
}
String query = '';
query = '';
query += ' SELECT Id ';
query += ' , Name ';
query += ' , Account__c ';
query += ' , Account__r.Id ';
query += ' From Test__c ';
query += ' WHERE Account__r.Id IN : accountIdList ';
system.debug('query:'+query);
List<Test__c> testLsit = Database.query(query);
[Python]except KeyboardInterrupt
except KeyboardInterrupt
Since Ctrl-C
causes KeyboardInterrupt
to be raised, just catch it outside the loop and ignore it.
[Python]KyeboardからWhile LoopでEvent作成
KyeboardからWhile LoopでEvent作成
def sample1(value):
print(value)
try:
while True:
value = input()
sample1(value)
except KeyboardInterrupt:
pass
結果
9
9
0
0
[Python]Kyeboard入力とFunctionの使い方
Kyeboard入力とFunctionの使い方
def sample1(value):
print(value)
value = input()
sample1(value)
結果
9
9
[Python]function呼び出し
function呼び出し
def sample1(a, b, c):
s = a + b - c
print(a)
if a == 0:
print(b)
else:
print(c)
sample1(1, 1, 2)
結果
1
2
[Python]Pythonインストールと動作確認
Pythonインストールと動作確認
・インストール
Windowsの場合、以下のURLにて、インストーラをダウンロードします。
https://www.python.org/downloads/windows/

・ダウンロードしたインストーラをPCにインストールします。
※インストール時、注意事項として、以下のように箇所にチェックいれて、「Install Now」押下します。

・インストール後に、PCの中に「test.py」ファイル作成して、その中に、以下のコードを入力して、保存します。
print("Hello world!")
保存場所は、例えば、C:\Python\test.py
・Python Versionを確認します。
Windowsの場合、コマンドプロンプトを起動して、まずPythonを確認します。
C:\Users\p445-PC>python --version
Python 3.11.1
・作成した、test.pyを実行します。
test.pyが保存されているDirectoryに移動します。
C:\>cd Python
test.py実行します。
C:\Python>python test.py
Hello world!
[Salesforce]Apexテストクラスのエラー「TestMethod として定義されたメソッドは、getContent コールをサポートしていません。」対応
Apexテストクラスのエラー「TestMethod として定義されたメソッドは、getContent コールをサポートしていません。」対応
attachmentFile.Body = Test.isRunningTest() ? Blob.valueof('testString') : pr.getContent();
[Salesforce]Apex StandardControllerテストクラス
Apex StandardControllerテストクラス
@isTest
private class Test_testController {
static testmethod void test1() {
Account acc = new Account(
Name='テスト'
);
insert acc;
Test.startTest();
ApexPages.StandardController sc = new ApexPages.StandardController(acc);
testController testSC = new testController(sc);
PageReference pageRef = Page.testPage;
pageRef.getParameters().put('id', String.valueOf(acc.Id));
Test.setCurrentPage(pageRef);
testSC.testMethod();
Test.stopTest();
}
}