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 = |,
}
}
}
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 append in the for loop but for some reason instead of appending at the end it changes all the existing values in the array.
let a = 2
class people {
var name = " "
var height = Int()
}
var trial = " "
var p = [people]()
var user = people()
for i in 0...a-1{
if(i==0){
user.name = "jack"
user.height = 180
}
else {
user.name = "ryan"
user.height = 120
}
p.append(user)
print(p[i].name, p[i].height);
}
for i in 0...a-1 {
print(p[i].name, p[i].height);
}
expectd: -
jack 180
ryan 120
jack 180
ryan 120
result:-
jack 180
ryan 120
ryan 120
ryan 120
You create only one instance of people and add this instance in your array for two times. but the problem is when you assign the value for the second time it replaces the previous value of the same instance.
You have to create new instnse of people inside your for loop for every new user. like below
let a = 2
class people {
var name = " "
var height = Int()
}
var trial = " "
var p = [people]()
//var user = people() remove this line from here and add inside for-loop
for i in 0...a-1{
var user = people() // add this line here.
if(i==0){
user.name = "jack"
user.height = 180
}
else {
user.name = "ryan"
user.height = 120
}
p.append(user)
print(p[i].name, p[i].height);
}
for i in 0...a-1 {
print(p[i].name, p[i].height);
}
I'm using an API to get weather condition and the retrieved dict is
dict = {
base = stations;
clouds = {
all = 92;
};
cod = 200;
coord = {
lat = "31.23";
lon = "121.47";
};
dt = 1476853699;
id = 1796231;
main = {
"grnd_level" = "1028.63";
humidity = 93;
pressure = "1028.63";
"sea_level" = "1029.5";
temp = "73.38";
"temp_max" = "73.38";
"temp_min" = "73.38";
};
name = "Shanghai Shi";
rain = {
3h = "0.665";
};
sys = {
country = CN;
message = "0.0125";
sunrise = 1476827992;
sunset = 1476868662;
};
weather = (
{
description = "light rain";
icon = 10d;
id = 500;
main = Rain;
}
);
wind = {
deg = "84.50239999999999";
speed = "5.97";
};
}
If I want the value of humidity, I just use
let humidityValue = dict["main"]["humidity"] and it works.
But the problem is I also want to get the value of description in weather
when I used let dscptValue = dict["weather"]["description"]
it retrieved nil.
How's that? and I notice there are two brackets around weather .I'm not sure whether it is the same with the statement without brackets.
weather = (
{
description = "light rain";
icon = 10d;
id = 500;
main = Rain;
}
);
How to get the value of description?
weather keys contains Array of Dictionary not directly Dictionary, so you need to access the first object of it.
if let weather = dict["weather"] as? [[String: AnyObject]], let weatherDict = weather.first {
let dscptValue = weatherDict["description"]
}
Note: I have used optional wrapping with if let for preventing crash with forced wrapping.
Weather is an array of dictionaries.
dict["weather"][0]["description"]
may give you the expected result.
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}
I have this TypoSript:
Contance:
finish_day_value = TSFE:fe_user|sesData|finish_day
Setup:
plugin.Tx_Formhandler.settings.predef.formhandler-multistep-forms {
if {
1 {
conditions.OR1 {
AND1 = {$finish_day_value} > 7
AND2 = {$finish_day_value} < 15
}
isTrue {
markers.input_readonly_a_price = CONTENT
markers.input_readonly_a_price {
table = tx_pricelist_prices_full
select {
pidInList = {$get_carpid}
orderBy = uid
selectFields = uid, group_a_8_14
# possible conditions
where = ( tx_pricelist_prices_full.uid='1' AND hidden='0' AND deleted='0')
}
renderObj = COA
renderObj {
#value
1 = TEXT
1.insertData = 1
1.data = field:group_a_8_14
2 = TEXT
2.value = *
3 = TEXT
3.insertData = 1
3.data = TSFE:fe_user|sesData|finish_day
stdWrap.prioriCalc = 1
}
}
}
}
}
}
The finish_day value is sending by the session from one form to another (that's why I use TSFE:fe_user|sesData|finish_day). But when I insert it to Setup (for example):
AND1 = TSFE:fe_user|sesData|finish_day > 7
AND2 = TSFE:fe_user|sesData|finish_day < 15
Nothings happens. So I try to define Constance value, but still nothing.
How to call the session value (finish_day) and use it on AND conditions?
Thanks for any help
What you want to do is very specific. It depends on the extension you use.
If for AND1 is stdWrap implemented, you can use:
AND1.data = TSFE:fe_user|sesData|finish_day
AND1.intval = 1
AND1.noTrimWrap = | | > 7|
data: imports the data of the session
intval: we expect an integer, no chance for sql-injection here
noTrimWrap: i do not know, if you need the extra spaces.
I used GlobalVar conditions:
[globalVar = TSFE:fe_user|sesData|finish_day > 0] && [globalVar = TSFE:fe_user|sesData|finish_day < 4 ]
...
ts
...
[global]