Hi, I am new on Qlik so maybe my question is so simple, or not 🙂
I have this script to load my App in Qlik Cloud:
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='$#.##0,00;-$#.##0,00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET FirstWeekDay=0;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='es-AR';
SET CreateSearchIndexOnReload=1;
SET MonthNames='ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sep.;oct.;nov.;dic.';
SET LongMonthNames='enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre;diciembre';
SET DayNames='lun.;mar.;mié.;jue.;vie.;sáb.;dom.';
SET LongDayNames='lunes;martes;miércoles;jueves;viernes;sábado;domingo';
LIB CONNECT TO 'Data:Data1';
[vw_datos]:
SELECT "mont",
"dr_name",
"dr_cu",
"emp_nom",
"cli_cod",
"cli_id",
"cli_name",
"cli_eco_ac_ce",
"cli_eco_ac_des",
"cuen_eje",
"ing_fech",
"asu_fech",
"docu_fech",
"real_depo_fech",
"depo_fech",
"accre_fech",
"vend_fech",
"rech_fech",
"docu_term",
"docu_id",
"depos_fina_prov_nom",
"depos_fina_prov_clav",
"vend_fina_prov_nom",
"vend_fina_prov_clav",
"marc_codi",
"marc_desc",
"docu_type",
"docu_owner",
"docu_state",
"is_electronic",
"emp_code",
"sucu_code",
"py_domain",
"docu_number",
"acc_num",
"settlement_id",
"settlement_number",
"adn",
"adn_value",
"tef",
"tef_value",
"exp_not_order",
"exp_not_order_value",
"value_collection",
"value_collection_value",
"organization_expenses",
"organization_expenses_value",
"docu_fixed_cost",
"op_fixed_cost",
"op_fixed_cost_value",
"port_sale_req_adn",
"port_sale_req_num",
"port_sale_req_com",
"port_sale_req_fin_prov_nam",
"port_sale_req_fin_prov_clave",
"port_sale_req_confir_fech"
FROM "public"."vw_datos" WHERE (docu_state = 'VEN' or docu_state = 'OPE' or docu_state = 'VEND' or docu_state = 'DEP' or docu_state = 'FID' ) ;
LIB CONNECT TO 'Data:Data1';
[vw_cust]:
SELECT "ownerid",
"businessname",
"clav",
"balance"
FROM "public"."vw_cust";
I neet to concatenate :
"emp_code", "sucu_code", "py_domain", "docu_number", "acc_num" only if "is_electronic"= True to get a new string called SKU
Can I do that in the load script of the app so then I can add the SKU value where I need ?
Or, if it is no possible, there is a way to do that in Qlik Cloud to avoid export it to XLSX file and do it in Excell whit the formula =A2&""&B2&""&C2&""&D2&""&E2&"" ?
Thanks in advance for your help 🙂
@cachirulo this is my bad, try this instead
[vw_datos]:
LOAD *,
If("is_electronic" = 'True', "emp_code" & '|' & "sucu_code" & '|' & "py_domain" & '|' & "docu_number" & '|' & "acc_num") as SKU;
SELECT "mont",
"dr_name",
"dr_cu",
"emp_nom",
"cli_cod",
"cli_id",
"cli_name",
"cli_eco_ac_ce",
"cli_eco_ac_des",
"cuen_eje",
"ing_fech",
"asu_fech",
"docu_fech",
"real_depo_fech",
"depo_fech",
"accre_fech",
"vend_fech",
"rech_fech",
"docu_term",
"docu_id",
"depos_fina_prov_nom",
"depos_fina_prov_clav",
"vend_fina_prov_nom",
"vend_fina_prov_clav",
"marc_codi",
"marc_desc",
"docu_type",
"docu_owner",
"docu_state",
"is_electronic",
"emp_code",
"sucu_code",
"py_domain",
"docu_number",
"acc_num",
"settlement_id",
"settlement_number",
"adn",
"adn_value",
"tef",
"tef_value",
"exp_not_order",
"exp_not_order_value",
"value_collection",
"value_collection_value",
"organization_expenses",
"organization_expenses_value",
"docu_fixed_cost",
"op_fixed_cost",
"op_fixed_cost_value",
"port_sale_req_adn",
"port_sale_req_num",
"port_sale_req_com",
"port_sale_req_fin_prov_nam",
"port_sale_req_fin_prov_clave",
"port_sale_req_confir_fech"
FROM "public"."vw_datos" WHERE (docu_state = 'VEN' or docu_state = 'OPE' or docu_state = 'VEND' or docu_state = 'DEP' or docu_state = 'FID' ) ;
LIB CONNECT TO 'Data:Data1';
[vw_cust]:
SELECT "ownerid",
"businessname",
"clav",
"balance"
FROM "public"."vw_cust";
Maybe you can do something like this?
LOAD
IF(is_electronic= 'True', emp_code & sucu_code & py_domain & docu_number & acc_num , null()) as SKU ,
[...]
I think Vegar's Suggestion will work try it out 🙂
Hi @Vegar , @tomovangel
Thanks for your help !
I added that sentence to the script:
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='$#.##0,00;-$#.##0,00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET FirstWeekDay=0;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='es-AR';
SET CreateSearchIndexOnReload=1;
SET MonthNames='ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sep.;oct.;nov.;dic.';
SET LongMonthNames='enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre;diciembre';
SET DayNames='lun.;mar.;mié.;jue.;vie.;sáb.;dom.';
SET LongDayNames='lunes;martes;miércoles;jueves;viernes;sábado;domingo';
LIB CONNECT TO 'Data:Data1';
[vw_datos]:
SELECT "mont",
"dr_name",
"dr_cu",
"emp_nom",
"cli_cod",
"cli_id",
"cli_name",
"cli_eco_ac_ce",
"cli_eco_ac_des",
"cuen_eje",
"ing_fech",
"asu_fech",
"docu_fech",
"real_depo_fech",
"depo_fech",
"accre_fech",
"vend_fech",
"rech_fech",
"docu_term",
"docu_id",
"depos_fina_prov_nom",
"depos_fina_prov_clav",
"vend_fina_prov_nom",
"vend_fina_prov_clav",
"marc_codi",
"marc_desc",
"docu_type",
"docu_owner",
"docu_state",
"is_electronic",
"emp_code",
"sucu_code",
"py_domain",
"docu_number",
"acc_num",
"settlement_id",
"settlement_number",
"adn",
"adn_value",
"tef",
"tef_value",
"exp_not_order",
"exp_not_order_value",
"value_collection",
"value_collection_value",
"organization_expenses",
"organization_expenses_value",
"docu_fixed_cost",
"op_fixed_cost",
"op_fixed_cost_value",
"port_sale_req_adn",
"port_sale_req_num",
"port_sale_req_com",
"port_sale_req_fin_prov_nam",
"port_sale_req_fin_prov_clave",
"port_sale_req_confir_fech"
FROM "public"."vw_datos" WHERE (docu_state = 'VEN' or docu_state = 'OPE' or docu_state = 'VEND' or docu_state = 'DEP' or docu_state = 'FID' ) ;
LIB CONNECT TO 'Data:Data1';
[vw_cust]:
SELECT "ownerid",
"businessname",
"clav",
"balance"
FROM "public"."vw_cust";
LOAD
IF(is_electronic= 'True', emp_code & sucu_code & py_domain & docu_number & acc_num , null()) as SKU ,
I reload the app, but when I go to edit the table to add the column "SKU", It is not listed with the others attributtes...
I added the sentence in the correct line ? Where I need to add ? What I am doing wrong ?
Thanks a lot in advance.
Try this @cachirulo
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='$#.##0,00;-$#.##0,00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET FirstWeekDay=0;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='es-AR';
SET CreateSearchIndexOnReload=1;
SET MonthNames='ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sep.;oct.;nov.;dic.';
SET LongMonthNames='enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre;diciembre';
SET DayNames='lun.;mar.;mié.;jue.;vie.;sáb.;dom.';
SET LongDayNames='lunes;martes;miércoles;jueves;viernes;sábado;domingo';
LIB CONNECT TO 'Data:Data1';
[vw_datos]:
SELECT "mont",
"dr_name",
"dr_cu",
"emp_nom",
"cli_cod",
"cli_id",
"cli_name",
"cli_eco_ac_ce",
"cli_eco_ac_des",
"cuen_eje",
"ing_fech",
"asu_fech",
"docu_fech",
"real_depo_fech",
"depo_fech",
"accre_fech",
"vend_fech",
"rech_fech",
"docu_term",
"docu_id",
"depos_fina_prov_nom",
"depos_fina_prov_clav",
"vend_fina_prov_nom",
"vend_fina_prov_clav",
"marc_codi",
"marc_desc",
"docu_type",
"docu_owner",
"docu_state",
"is_electronic",
"emp_code",
"sucu_code",
"py_domain",
"docu_number",
"acc_num",
"settlement_id",
"settlement_number",
"adn",
"adn_value",
"tef",
"tef_value",
"exp_not_order",
"exp_not_order_value",
"value_collection",
"value_collection_value",
"organization_expenses",
"organization_expenses_value",
"docu_fixed_cost",
"op_fixed_cost",
"op_fixed_cost_value",
"port_sale_req_adn",
"port_sale_req_num",
"port_sale_req_com",
"port_sale_req_fin_prov_nam",
"port_sale_req_fin_prov_clave",
"port_sale_req_confir_fech",
If("is_electronic" = 'True', "emp_code" & '|' & "sucu_code" & '|' & "py_domain" & '|' & "docu_number" & '|' & "acc_num") as SKU
FROM "public"."vw_datos" WHERE (docu_state = 'VEN' or docu_state = 'OPE' or docu_state = 'VEND' or docu_state = 'DEP' or docu_state = 'FID' ) ;
LIB CONNECT TO 'Data:Data1';
[vw_cust]:
SELECT "ownerid",
"businessname",
"clav",
"balance"
FROM "public"."vw_cust";
Thanks @sunny_talwar ; I try it but I get this error Message 😐:
---
ERROR: operator does not exist: character varying & unknown
LINE 57: If("is_electronic" = 'True', "emp_code" & '|' & "sucu...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.)
@cachirulo this is my bad, try this instead
[vw_datos]:
LOAD *,
If("is_electronic" = 'True', "emp_code" & '|' & "sucu_code" & '|' & "py_domain" & '|' & "docu_number" & '|' & "acc_num") as SKU;
SELECT "mont",
"dr_name",
"dr_cu",
"emp_nom",
"cli_cod",
"cli_id",
"cli_name",
"cli_eco_ac_ce",
"cli_eco_ac_des",
"cuen_eje",
"ing_fech",
"asu_fech",
"docu_fech",
"real_depo_fech",
"depo_fech",
"accre_fech",
"vend_fech",
"rech_fech",
"docu_term",
"docu_id",
"depos_fina_prov_nom",
"depos_fina_prov_clav",
"vend_fina_prov_nom",
"vend_fina_prov_clav",
"marc_codi",
"marc_desc",
"docu_type",
"docu_owner",
"docu_state",
"is_electronic",
"emp_code",
"sucu_code",
"py_domain",
"docu_number",
"acc_num",
"settlement_id",
"settlement_number",
"adn",
"adn_value",
"tef",
"tef_value",
"exp_not_order",
"exp_not_order_value",
"value_collection",
"value_collection_value",
"organization_expenses",
"organization_expenses_value",
"docu_fixed_cost",
"op_fixed_cost",
"op_fixed_cost_value",
"port_sale_req_adn",
"port_sale_req_num",
"port_sale_req_com",
"port_sale_req_fin_prov_nam",
"port_sale_req_fin_prov_clave",
"port_sale_req_confir_fech"
FROM "public"."vw_datos" WHERE (docu_state = 'VEN' or docu_state = 'OPE' or docu_state = 'VEND' or docu_state = 'DEP' or docu_state = 'FID' ) ;
LIB CONNECT TO 'Data:Data1';
[vw_cust]:
SELECT "ownerid",
"businessname",
"clav",
"balance"
FROM "public"."vw_cust";
Thanks a lot for all who give your time to this 🙂