I have a crystal report that I am modifying the record selection formula. I have a parameter "Inventory_Class" that can have 3 values 0, 1 or 2. If set to 1 I want my DB field "NON_Controllable" that is binary field to select all False records, if the parameter is set to 2 then I want all True records but if the incoming parameter is set to 0 then I don't want to filter on the DB field "NON_Controllable" at all. I can get formula to work when parameter is set to 1 and 2 selecting Non_Controllable false and true records but when the parameter is set to 0 my report returns no records when it should be returning all records.
{Inventory_Catalog.PROP_NO} = {?PROPERTY} and
{Inventory_Cat_Header.INVEN_TYPE_CD} = {?TYPE} and
{Inventory_Cat_Header.OPER_BUS_SEG_CD} = {?OPER_BUS_SEG} and
{Inventory_Catalog.SURP} = {?SURP} and
{Inventory_Catalog.COND_CD} = {?CONDITION} and
{Inventory_Cat_Header.INVEN_ID} = {?INVEN_ID} and
{Inventory_Catalog.SER_NO} = {?SERIAL} and
{Inventory_Cat_Header.BUS_UNIT_CD} = {?BUS_UNIT_CD} and
IF ({?INVENTORY_CLASS} = 1) THEN
{Inventory_Cat_Header.NON_CONTROLLABLE} = FALSE
ELSE IF ({?INVENTORY_CLASS} = 2) THEN
{Inventory_Cat_Header.NON_CONTROLLABLE} = TRUE
ELSE IF ({?INVENTORY_CLASS} = 0) THEN
NOT {Inventory_Cat_Header.NON_CONTROLLABLE}
How can I modify this formula to work?
you can try passing the parameters for each conditions instead.
IF
({?INVENTORY_CLASS} = 1) THEN
{Inventory_Cat_Header.NON_CONTROLLABLE} = FALSE and
{Inventory_Catalog.PROP_NO} = {?PROPERTY} and
{Inventory_Cat_Header.INVEN_TYPE_CD} = {?TYPE} and
{Inventory_Cat_Header.OPER_BUS_SEG_CD} = {?OPER_BUS_SEG} and
{Inventory_Catalog.SURP} = {?SURP} and
{Inventory_Catalog.COND_CD} = {?CONDITION} and
{Inventory_Cat_Header.INVEN_ID} = {?INVEN_ID} and
{Inventory_Catalog.SER_NO} = {?SERIAL} and
{Inventory_Cat_Header.BUS_UNIT_CD} = {?BUS_UNIT_CD}
ELSE IF
({?INVENTORY_CLASS} = 2) THEN
{Inventory_Cat_Header.NON_CONTROLLABLE} = TRUE and
{Inventory_Catalog.PROP_NO} = {?PROPERTY} and
{Inventory_Cat_Header.INVEN_TYPE_CD} = {?TYPE} and
{Inventory_Cat_Header.OPER_BUS_SEG_CD} = {?OPER_BUS_SEG} and
{Inventory_Catalog.SURP} = {?SURP} and
{Inventory_Catalog.COND_CD} = {?CONDITION} and
{Inventory_Cat_Header.INVEN_ID} = {?INVEN_ID} and
{Inventory_Catalog.SER_NO} = {?SERIAL} and
{Inventory_Cat_Header.BUS_UNIT_CD} = {?BUS_UNIT_CD}
else
{Inventory_Catalog.PROP_NO} = {?PROPERTY} and
{Inventory_Cat_Header.INVEN_TYPE_CD} = {?TYPE} and
{Inventory_Cat_Header.OPER_BUS_SEG_CD} = {?OPER_BUS_SEG} and
{Inventory_Catalog.SURP} = {?SURP} and
{Inventory_Catalog.COND_CD} = {?CONDITION} and
{Inventory_Cat_Header.INVEN_ID} = {?INVEN_ID} and
{Inventory_Catalog.SER_NO} = {?SERIAL} and
{Inventory_Cat_Header.BUS_UNIT_CD} = {?BUS_UNIT_CD}
Related
I'm creating a data entry form to a database sheet, previously I've managed to create a single cell data entry form. But now I'm going to create a data entry form that is entered in the range B6:N10. How do I modify it?
function SIMPAN1() {
var Sheet = SpreadsheetApp.openById("1hnezkq89bgVUvimYDdAfWDVY01f7ekFN3T6TY3Ui6oA");
var sheetInput = Sheet.getSheetByName('INPUT');
var sheetDb = Sheet.getSheetByName('DATABASE');
var lastRow = sheetDb.getRange("B1").getDataRegion().getLastRow();
lastRow += 1
var data1 = [[tgl1 = sheetInput.getRange('B6').getValue(),
nama1 = sheetInput.getRange('C6').getValue(),
kls1 = sheetInput.getRange('D6').getValue(),
srthfl1 = sheetInput.getRange('E6').getValue(),
aythfl1 = sheetInput.getRange('F6').getValue(),
nilaithfz1 = sheetInput.getRange('G6').getValue(),
jldsrt1 = sheetInput.getRange('H6').getValue(),
hlmayt1 = sheetInput.getRange('I6').getValue(),
mtri1 = sheetInput.getRange('J6').getValue(),
nilaitrtl1 = sheetInput.getRange('K6').getValue(),
prgst1 = sheetInput.getRange('L6').getValue(),
prgda1 = sheetInput.getRange('M6').getValue(),
ket1 = sheetInput.getRange('N6').getValue(),]];
sheetDb.getRange("B" + lastRow + ":N" + lastRow).setValues(data1);
}
Try this:
function SIMPAN1() {
const ss = SpreadsheetApp.openById("ssid");
const ish = ss.getSheetByName('INPUT');
const dsh = ss.getSheetByName('DATABASE');
const ivs = ish.getRange(6, 2, 1, 13).getValues();
dsh.getRange(dsh.getLastRow() + 1, 2, ivs.length, ivs[0].length).setValues(ivs);
}
I am trying to set a value for "background color" as seen below but when I print the value after setting it, it simply shows nil? This makes absolutely no sense. Please help, I have exhausted all resources already.
Thank you.
let request = GTLRSheets_Request.init()
request.repeatCell = GTLRSheets_RepeatCellRequest.init()
let colbox = GTLRSheets_GridRange.init()
colbox.startRowIndex = rowstart
colbox.endRowIndex = rowend
colbox.startColumnIndex = columnstart
colbox.endColumnIndex = columnend
request.repeatCell?.range = colbox
let color = GTLRSheets_Color.init()
color.blue = 60
color.red = 47
color.green = 77
request.repeatCell?.cell?.userEnteredFormat?.backgroundColor = color
request.repeatCell?.cell?.userEnteredFormat?.textFormat?.bold = true
request.repeatCell?.cell?.userEnteredFormat?.horizontalAlignment = "CENTER"
request.repeatCell?.fields = "userEnteredFormat(backgroundColor,textFormat,horizontalAlignment)"
print(request.repeatCell?.cell?.userEnteredFormat?.backgroundColor)
let batchUpdate = GTLRSheets_BatchUpdateSpreadsheetRequest.init()
batchUpdate.requests = [request]
let createQuery = GTLRSheetsQuery_SpreadsheetsBatchUpdate.query(withObject: batchUpdate, spreadsheetId: spreadsheetId)
service.executeQuery(createQuery) { (ticket, result, NSError) in
}
Issue:
You should initialize cell and userEnteredFormat.
Solution:
cell refers to an instance of GTLRSheets_CellData, and should be initialized the following way:
request.repeatCell?.cell = GTLRSheets_CellData.init()
userEnteredFormat refers to an instance of GTLRSheets_CellFormat:
request.repeatCell?.cell?.userEnteredFormat = GTLRSheets_CellFormat.init()
Reference:
GTLRSheets_CellData
GTLRSheets_CellFormat
Swift: Initialization
I have 4 labels (dayString1, dayString2, dayString3 and dayString4) in which they will put a numerical value and what I need to do is that if the content of dayString1 is less than 60 than the dayString2 appears, and if the sum of dayString1 + dayString2 is less than 60 the dayString3 appears and so on; My logic was this, but it gives error:
(Ambiguous reference to operator function '<')
func chooseDays() {
self.dayString = dayTextField.text!
self.dayString2 = dayTextField2.text!
self.dayString3 = dayTextField3.text!
self.dayString4 = dayTextField4.text!
if dayString < 60 {
self.dateTextField2.isHidden = false
self.dayTextField2.isHidden = false
self.dateTextField3.isHidden = true
self.dayTextField3.isHidden = true
self.dateTextField4.isHidden = true
self.dayTextField4.isHidden = true
SearchConstraint.constant = 72
if dayString + dayString2 < 60 {
self.dateTextField2.isHidden = false
self.dayTextField2.isHidden = false
self.dateTextField3.isHidden = false
self.dayTextField3.isHidden = false
self.dateTextField4.isHidden = true
self.dayTextField4.isHidden = true
SearchConstraint.constant = 112
if dayString + dayString2 + dayString3 < 60 {
self.dateTextField2.isHidden = false
self.dayTextField2.isHidden = false
self.dateTextField3.isHidden = false
self.dayTextField3.isHidden = false
self.dateTextField4.isHidden = false
self.dayTextField4.isHidden = false
SearchConstraint.constant = 152
}
}
}
return
}
You need to type caste string to integer before performing any comparison with another integer like this:
if Int(dayString) < 60 {
Also do nil coalescing technique to handle unwrapping of texts from textfields:
self.dayString = dayTextField.text ?? "0"
self.dayString2 = dayTextField2.text ?? "0"
self.dayString3 = dayTextField3.text ?? "0"
self.dayString4 = dayTextField4.text ?? "0"
I am trying to get the usergroup titles which belong to the current fe_user.
I have this script as an example, but it returns me all the usergroups.
If I only implement the first 3 lines, the correct usergroup uid comes out. What should be changed?
30 = TEXT
30.data = TSFE:fe_user|user|usergroup
30.required = 1
30.split {
token = ,
cObjNum = 1 || 2
1 {
10 = CONTENT
10.table = fe_groups
10.select.pidInList = 25
10.select.andWhere.current = 1
10.select.andWhere.wrap = uid=|
10.renderObj = TEXT
10.renderObj.field = title
10.renderObj.wrap = |,
}
2 < .1
2.10.renderObj.wrap >
}
Ok I found it, the problem was andWhere, it should be where.
30 = TEXT
30 {
data = TSFE:fe_user|user|usergroup
required = 1
split {
token = ,
cObjNum = 1
1.10 = CONTENT
1.10 {
table = fe_groups
select {
pidInList = {$pages.frontEndUsers}
where.current = 1
where.wrap = uid=|
}
renderObj = TEXT
renderObj.field = title
renderObj.wrap = |,
}
}
}
I need to filter following array with status equal to "U" and i have used following.
NSArray *result = [alertModified.senders filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:#"(subscriptions.status = %#)",#"U"]];
But I'm getting empty arrays.
Please help me on filtering this?
Array String:
(senderCode = CPFB, senderName = CPFB, forSenderLevel = 0, subscriptions = (
"correspondenceListId = 102,status = S,senderCode = AA,subject = Letter,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 103,status = U,senderCode = BB,subject = Nomination Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 104,status = U,senderCode = AA,subject = Yearly statements,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 105,status = U,senderCode = BB,subject = All Future Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = "))
In your example you should be filtering the subscription list itself, not the whole senders. You have to apply the filter to each sender. Try changing your filter line to this and check if it gives you results:
NSArray *result = [[alertModified.senders objectAtIndex:0].subscriptions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:#"(status = %#)",#"U"]];