CONCATENATE SUBTR
Hi,
I'm trying to SUBSTR 2 concatenatd to fields that are varchar2(4000) each into 4000.
CASE
WHEN jd.noc_requirements_override_yn = 'Y'
THEN pdrequire.position_description
WHEN jd.noc_requirements_override_yn = 'N'
THEN SUBSTR(DECODE (pdrequire.position_description,
NULL, NULL,
pdrequire.position_description
|| ' '
|| DECODE (1,
1, cdrequirenoc.employment_requirement_en,
cdrequirenoc.employment_requirement_fr
),1,4000)
END requirements,But getting this error:
[Error] Execution (853: 41): ORA-01489: result of string concatenation is too long
Keep in mind that I want to SUBSTR to 4000 the COMBINATION of the 2 fields AND NOT SUBSTR (field 1, 2000) and SUBSTR (field 2, 2000)
Can somebody help?
Thanks in advance,
Marc.
It worked on it's own, but when I incorporate it into my BIG select I get an error...
[Error] Execution (240: 28): ORA-00932: inconsistent datatypes: expected CHAR got CLOB
Here's the BIG select:
SELECT DISTINCT jd.system_file_number systemfilenumber,
hrcc.hrc_number
|| ' - '
|| DECODE (1,
1, hrcc.office_name_en,
hrcc.office_name_fr
) hrccname,
o.organization_id employerid,
DECODE (o_bd.naics_id,
NULL, NULL,
o_bd.naics_id
|| ' - '
|| DECODE (1,
1, cdnaics.naics_title_en,
cdnaics.naics_title_fr
) naicsname,
o.organization_name employername,
o_adrs.address_line_1 employeraddress1,
o_adrs.address_line_2 employeraddress2,
o_adrs.city employercity,
-- ORGANIZATION PROVINCE / STATE
CASE
WHEN o_adrs.province_id IS NOT NULL
THEN DECODE (1,
1, cdprov.province_name_en,
cdprov.province_name_fr
WHEN o_adrs.state_id IS NOT NULL
THEN DECODE (1,
1, cdstate.state_name_en,
cdstate.state_name_fr
ELSE NULL
END employerprovstate,
o_adrs.postal_code employerpostalcode,
CASE
WHEN o_adrs.country_id IN (53, 309)
THEN DECODE (1,
1, cdcountry.country_short_name_en,
cdcountry.country_short_name_fr
ELSE o_adrs.other_country_text
END employercountry,
DECODE (ep.phone_number,
NULL, ep.foreign_number,
fwutil_pkg.formatphone (ep.area_code, ep.phone_number)
) employerphone,
(SELECT ssct.NAME contactname
FROM job_definitions ssjd,
requests_for_opinion ssrfo,
contacts ssct,
contact_rfo ssctr,
phones ssph
WHERE ssjd.system_file_number = 7531559
AND ssrfo.request_for_opinion_id =
ssjd.request_for_opinion_id
AND ssctr.request_for_opinion_id(+) =
ssrfo.request_for_opinion_id
AND ssct.contact_id(+) = ssctr.contact_id
AND ssctr.third_party_id IS NULL
AND ssph.contact_id(+) = ssct.contact_id
AND ssph.phone_type_id = 2
AND ssctr.primary_contact_yn = 'Y'
AND ssctr.date_deleted IS NULL) employercontactname,
(SELECT NVL (fwutil_pkg.formatphone (ssph.area_code,
ssph.phone_number,
ssph.ext_number
ssph.foreign_number) contactphone
FROM job_definitions ssjd,
requests_for_opinion ssrfo,
contacts ssct,
contact_rfo ssctr,
phones ssph
WHERE ssjd.system_file_number = 7531559
AND ssrfo.request_for_opinion_id =
ssjd.request_for_opinion_id
AND ssctr.request_for_opinion_id(+) =
ssrfo.request_for_opinion_id
AND ssct.contact_id(+) = ssctr.contact_id
AND ssctr.third_party_id IS NULL
AND ssph.contact_id(+) = ssct.contact_id
AND ssph.phone_type_id = 2
AND ssctr.primary_contact_yn = 'Y'
AND ssctr.date_deleted IS NULL ) employercontactphone,
-- Only want the Third Party Contact name
DECODE (crfo.third_party_id,
NULL, NULL,
c.NAME
) contactname,
tp.third_party_name thirdpartyname,
tp_adrs.address_line_1 thirdpartyaddress1,
tp_adrs.address_line_2 thirdpartyaddress2,
tp_adrs.city thirdpartycity,
-- THIRD PARTY PROVINCE / STATE
CASE
WHEN tp_adrs.province_id IS NOT NULL
THEN DECODE (1,
1, tpcdprov.province_name_en,
tpcdprov.province_name_fr
WHEN tp_adrs.state_id IS NOT NULL
THEN DECODE (1,
1, tpcdstate.state_name_en,
tpcdstate.state_name_fr
ELSE NULL
END thirdpartyprovstate,
tp_adrs.postal_code thirdpartypostalcode,
CASE
WHEN tp_adrs.country_id IN (53, 309)
THEN DECODE (1,
1, tpcdcountry.country_short_name_en,
tpcdcountry.country_short_name_fr
ELSE tp_adrs.other_country_text
END thirdpartycountry,
-- only want the Third party phone
CASE
WHEN crfo.third_party_id IS NOT NULL
THEN DECODE (tpp.phone_number,
NULL, tpp.foreign_number,
fwutil_pkg.formatphone (tpp.area_code,
tpp.phone_number)
ELSE NULL
END thirdpartyphone,
-- only want the Third party fax
CASE
WHEN crfo.third_party_id IS NOT NULL
THEN DECODE (tpf.phone_number,
NULL, tpf.foreign_number,
fwutil_pkg.formatphone (tpf.area_code,
tpf.phone_number)
ELSE NULL
END thirdpartyfax,
tp.email_address thirdpartyemail,
( jd.number_of_positions
- global_pkg.fnglobal_getcancelledpositions
(jd.system_file_number)
) numberofpositions,
DECODE (1,
1, cdrt.request_type_name_en,
cdrt.request_type_name_fr
) requesttype,
CASE
WHEN jd.duration_unit_id = 5
THEN -- Indeterminate/Permanent
DECODE (1,
1, cdduc.duration_unit_name_en,
cdduc.duration_unit_name_fr
ELSE jd.duration_of_employment
|| ' '
|| DECODE (1,
1, cdduc.duration_unit_name_en,
cdduc.duration_unit_name_fr
END DURATION,
TO_CHAR (op.current_conf_exp_date, 'YYYY-MM-DD')
confirmationexpirydate,
-- ORAL LANGUAGE REQUIREMENTS
CASE
WHEN jd.oral_language_id IN (1, 8, 11, 13)
THEN DECODE (1,
1, cdorallang.language_name_en,
cdorallang.language_name_fr
WHEN jd.oral_language_id = 64
THEN jd.oral_lang_other_text
WHEN jd.oral_language_id IN
(81, 88, 91, 93, 97, 104, 107, 109)
THEN DECODE (1,
1, cdorallang.language_desc_en,
cdorallang.language_desc_fr
|| ' '
|| jd.oral_lang_other_text
ELSE NULL
END orallanguage,
-- WRITTEN LANGUAGE REQUIREMENTS
CASE
WHEN jd.written_language_id IN (1, 8, 11, 13)
THEN DECODE (1,
1, cdwrittenlang.language_name_en,
cdwrittenlang.language_name_fr
WHEN jd.written_language_id = 64
THEN jd.written_lang_other_text
WHEN jd.written_language_id IN
(81, 88, 91, 93, 97, 104, 107, 109)
THEN DECODE (1,
1, cdwrittenlang.language_desc_en,
cdwrittenlang.language_desc_fr
|| ' '
|| jd.written_lang_other_text
ELSE NULL
END writtenlanguage,
-- Requirements, position_desc_code_id = 2
case
when jd.noc_requirements_override_yn = 'Y'
then
to_clob(pdrequire.position_description)
when jd.noc_requirements_override_yn = 'N'
then
substr(to_clob (pdrequire.position_description)
|| to_clob (' ')
|| to_clob (decode (1, 1, cdrequirenoc.employment_requirement_en, cdrequirenoc.employment_requirement_fr)),1,4000)
end requirements,
-- Duties, position_desc_code_id = 1
CASE
WHEN jd.noc_duties_override_yn = 'Y'
THEN pdduties.position_description
WHEN jd.noc_duties_override_yn = 'N'
THEN TO_CLOB(pdduties.position_description)
||TO_CLOB(' ')
||TO_CLOB(DECODE (1,
1, cddutiesnoc.main_duty_desc_en,
cddutiesnoc.main_duty_desc_fr
END duties,
-- WAGE, other = 8
CASE
WHEN jd.wage_unit_id IS NULL
THEN NULL
WHEN jd.wage_unit_id = 8
THEN TRIM (TO_CHAR (jd.wage, '99999999999999999999999990.99'))
|| ' '
|| jd.wage_unit_other
ELSE TRIM (TO_CHAR (jd.wage, '99999999999999999999999990.99'))
|| ' / '
|| DECODE (1,
1, wuc.wage_unit_name_en,
wuc.wage_unit_name_fr
END wage,
TO_CHAR (jd.hours_per_day) hoursperday,
TO_CHAR (jd.hours_per_week) hoursperweek,
TO_CHAR (jd.hours_per_month) hourspermonth,
-- NOC Info
jd.noc_id noccode,
CASE
WHEN jd.noc_title IS NOT NULL
THEN jd.noc_title
ELSE DECODE (1,
1, cdnoc.name_label_en,
cdnoc.name_label_fr
END noctitle,
-- BENEFITS
CASE
WHEN ((b.disability_insurance_yn = 'N'
OR b.disability_insurance_yn IS NULL
AND (b.medical_insurance_yn = 'N'
OR b.medical_insurance_yn IS NULL
AND (b.dental_insurance_yn = 'N'
OR b.dental_insurance_yn IS NULL
AND (b.pension_yn = 'N'
OR b.pension_yn IS NULL)
AND (b.transportation_yn = 'N'
OR b.transportation_yn IS NULL)
AND (b.other_benefit_text IS NULL)
THEN CASE
WHEN UPPER (jd.user_created) = 'CONVERSION'
THEN DECODE
(1,
1, 'Converted record - consult HRSDC if needed',
'L''enregistrement converti - consultez RHDCC si ncessaire'
ELSE DECODE (1,
1, 'No benefits',
'Aucuns avantages'
END
ELSE RTRIM (TRIM ( DECODE (b.disability_insurance_yn,
'Y', DECODE (1,
1, 'Disability, ',
'Invalidit, '
|| DECODE (b.medical_insurance_yn,
'Y', DECODE (1,
1, ' Medical, ',
' Maladie, '
|| DECODE (b.dental_insurance_yn,
'Y', DECODE (1,
1, ' Dental, ',
' Dentaire, '
|| DECODE (b.pension_yn,
'Y', DECODE (1,
1, ' Pension, ',
' Pension, '
|| DECODE (b.transportation_yn,
'Y', DECODE (1,
1, ' Transport, ',
' Transport, '
|| b.other_benefit_text),
END benefits,
fwo.name_to_print nametoprint,
DECODE (fwo.phone_number,
NULL, NULL,
|| fwo.phone_area_code
|| ')'
|| SUBSTR (fwo.phone_number,
1,
3
|| '-'
|| SUBSTR (fwo.phone_number,
4,
4
|| ' '
|| fwo.phone_ext_number
) fwofficerphone,
DECODE (1,
1, cddec.decision_desc_en,
cddec.decision_desc_fr
) decision,
TO_CHAR(fw0160_pkg.fnfw0160_getdecisiondate
(op.decision_id,
op.opinion_status_id,
op.sent_to_province_date,
op.return_from_province_date,
op.decision_date
),'YYYY-MM-DD') decisiondate,
cic.cic_note_text cicnotes
FROM job_definitions jd
JOIN opinion_processes op ON op.system_file_number = jd.system_file_number
AND op.generates_process_id IS NULL
LEFT OUTER JOIN cic_notes cic ON cic.process_id = op.process_id
AND cic.expiry_date IS NULL
LEFT OUTER JOIN cd_decision_codes cddec ON cddec.decision_id = op.decision_id
JOIN requests_for_opinion rfo ON rfo.request_for_opinion_id = jd.request_for_opinion_id
JOIN hrcc ON hrcc.hrcc_id = rfo.hrcc_id
JOIN fw_officers fwo ON fwo.fw_officer_id = fw0800_pkg.fnfw0800_getactofficer4job(jd.system_file_number)
JOIN organizations o ON o.organization_id = rfo.organization_id
JOIN phones ep ON ep.organization_id = o.organization_id AND ep.phone_type_id = 2
JOIN addresses o_adrs ON o_adrs.address_id = o.address_id
JOIN cd_country_codes cdcountry ON cdcountry.country_id = o_adrs.country_id
LEFT OUTER JOIN cd_province_codes cdprov ON cdprov.province_id = o_adrs.province_id
LEFT OUTER JOIN cd_state_codes cdstate ON cdstate.state_id = o_adrs.state_id
LEFT OUTER JOIN business_details o_bd ON o_bd.organization_id = o.organization_id
LEFT OUTER JOIN contacts c ON c.contact_id = global_pkg.fnglobal_get3rdpartycon4rfo(rfo.request_for_opinion_id)
LEFT OUTER JOIN contact_rfo crfo ON crfo.request_for_opinion_id = jd.request_for_opinion_id
AND crfo.contact_id = c.contact_id
LEFT OUTER JOIN phones tpp ON tpp.contact_id = c.contact_id
AND tpp.phone_type_id = 2
LEFT OUTER JOIN phones tpf ON tpf.contact_id = c.contact_id
AND tpf.phone_type_id = 4
LEFT OUTER JOIN third_party tp ON tp.third_party_id = crfo.third_party_id
LEFT OUTER JOIN addresses tp_adrs ON tp_adrs.address_id = tp.address_id
LEFT OUTER JOIN cd_province_codes tpcdprov ON tpcdprov.province_id = tp_adrs.province_id
LEFT OUTER JOIN cd_state_codes tpcdstate ON tpcdstate.state_id = tp_adrs.state_id
LEFT OUTER JOIN cd_country_codes tpcdcountry ON tpcdcountry.country_id = tp_adrs.country_id
LEFT OUTER JOIN cd_noc cdnoc ON cdnoc.noc_id = jd.noc_id
LEFT OUTER JOIN cd_noc cdrequirenoc ON cdrequirenoc.noc_id = jd.noc_id
LEFT OUTER JOIN cd_noc cddutiesnoc ON cddutiesnoc.noc_id = jd.noc_id
LEFT OUTER JOIN position_descriptions pdrequire ON pdrequire.system_file_number = jd.system_file_number
AND pdrequire.position_desc_code_id = 2
LEFT OUTER JOIN position_descriptions pdduties ON pdduties.system_file_number = jd.system_file_number
AND pdduties.position_desc_code_id = 1
LEFT OUTER JOIN benefits b ON b.system_file_number = jd.system_file_number
LEFT OUTER JOIN cd_language_requirements cdorallang ON cdorallang.language_requirement_id = jd.oral_language_id
LEFT OUTER JOIN cd_language_requirements cdwrittenlang ON cdwrittenlang.language_requirement_id = jd.written_language_id
LEFT OUTER JOIN cd_duration_unit_codes cdduc ON cdduc.duration_unit_id = jd.duration_unit_id
LEFT OUTER JOIN cd_naics_codes cdnaics ON cdnaics.naics_id = o_bd.naics_id
LEFT OUTER JOIN cd_request_types cdrt ON cdrt.request_type_id = rfo.request_type_id
LEFT OUTER JOIN cd_wage_unit_codes wuc ON wuc.wage_unit_id = jd.wage_unit_id
WHERE jd.system_file_number = 7531559Hope this helps....
Thanks,
Marc.
Similar Messages
-
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Hai,
As Iam using Loop in a Loop iam getting time out dump .
in my internal table itab3 has unique objnr values.
for each objnr i have different status in itab_jcds.
each status column has diff status.
now i need to concatenate the status depending upon same objnr.
LOOP AT ITAB3 INTO WA_ITAB3.
RDX = SY-TABIX.
LOOP AT ITAB_JCDS INTO WA_ITAB_JCDS WHERE OBJNR = WA_ITAB3-OBJNR.
CONCATENATE WA_ITAB_JCDS-STATUS1 WA_ITAB3-STATUS1 INTO WA_ITAB3-STATUS1 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS2 WA_ITAB3-STATUS2 INTO WA_ITAB3-STATUS2 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS3 WA_ITAB3-STATUS3 INTO WA_ITAB3-STATUS3 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS4 WA_ITAB3-STATUS4 INTO WA_ITAB3-STATUS4 SEPARATED BY SPACE.
ENDLOOP.
MODIFY ITAB3 FROM WA_ITAB3 INDEX RDX
TRANSPORTING
OBJNR
STATUS1
STATUS2
STATUS3
STATUS4.
ENDLOOP.
example:
itab3
objnr
123
145
itab_jcds.
objnr stat1 stat2 stat3 stat4
123 nopr mav crtd rel
123 CRTD mnav rel prt
123 rel orsc txt crtd
now i req output as
itab3
objnr stat1 stat2 stat3 stat4.
123 nopr crtd rel mav mnav orsc crtd rel txt rel prt crtd
could u please help.Hi,
Try this way..
SORT ITAB3 BY OBJNR.
SORT ITAB_JCDS BY OBJNR.
LOOP AT ITAB3 INTO WA_ITAB3.
RDX = SY-TABIX.
READ TABLE ITAB_JCDS INTO WA_ITAB_JCDS WITH KEY OBJNR = WA_ITAB3-OBJNR.
BINARY SEARCH.
IF SY-SUBRC EQ 0.
LOOP AT ITAB_JCDS INTO WA_ITAB_JCDS FROM SY-TABIX.
IF WA_ITAB_JCDS-OBJNR NE WA_ITAB3-OBJNR.
EXIT.
ENDIF.
CONCATENATE WA_ITAB_JCDS-STATUS1 WA_ITAB3-STATUS1 INTO WA_ITAB3-STATUS1 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS2 WA_ITAB3-STATUS2 INTO WA_ITAB3-STATUS2 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS3 WA_ITAB3-STATUS3 INTO WA_ITAB3-STATUS3 SEPARATED BY SPACE.
CONCATENATE WA_ITAB_JCDS-STATUS4 WA_ITAB3-STATUS4 INTO WA_ITAB3-STATUS4 SEPARATED BY SPACE.
ENDLOOP.
MODIFY ITAB3 FROM WA_ITAB3 INDEX RDX
TRANSPORTING
OBJNR
STATUS1
STATUS2
STATUS3
STATUS4.
ENDIF.
ENDLOOP -
Using bind variable in dynamic where clause and concatenate with query
Hi,
In my procedure i am framing where clause dynamically with bind variable,When i am concatenate this with my sql query for REF CURSOR i got sql command not properly ended exception.
Is it possible to pass values to the bind variable through the dynamic variable/value?
Please advise
Thanks in advance
Siva
IF in_applicationId IS NOT NULL THEN
optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
END IF;
My query is like this
open Out_Main FOR SelectQuery USING optional_usingThanks for reply,
In my procedure, i suppose to frame the where clause with bind dynamically according to the input parameters. so that i am framing the values of the bind variables also dynamically like this,
Please advise...
IF in_assignedAppFlag IS NOT NULL THEN
IF in_assignedAppFlag = 'Y' THEN
optional_where := optional_where || ' AND b.ASSIGNED_TO = :b' ;
optional_using := ' in_appFuncGroup'||',in_currentUserID';
ELSe
IF in_isSupervisor = 0 THEN
optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
optional_using := ' in_appFuncGroup'||',in_currentUserID';
END IF;
END IF;
ELSE
IF in_isSupervisor = 0 THEN
optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
optional_using := ' in_appFuncGroup'||',in_currentUserID';
END IF;
END IF;
IF in_appFuncGroup IS NOT NULL THEN
optional_where := optional_where || ' AND e.APP_FUNC_GROUP= :c';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup';
END IF;
IF in_queue_id IS NOT NULL THEN
optional_where := optional_where || ' AND b.QUEUE_ID = :d';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id';
END IF;
IF in_applicationId IS NOT NULL THEN
optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
END IF;
IF in_sourceCode IS NOT NULL THEN
optional_where := optional_where || ' AND e.APP_SOURCE_CODE like '||':f%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode';
END IF;
IF in_logo IS NOT NULL THEN
optional_where := optional_where || ' AND appProds.PRODUCT_TYPE like '||':g%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo';
END IF;
IF in_firstName IS NOT NULL THEN
optional_where := optional_where || ' AND upper(a.FIRST_NAME) like upper(:h%)';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName';
END IF;
IF in_surName IS NOT NULL THEN
optional_where := optional_where || ' AND upper(a.SURNAME) like upper(:i%)';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName';
END IF;
IF in_retreival_id IS NOT NULL THEN
optional_where := optional_where || ' AND e.RETREIVAL_ID like :j%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName'||',in_retreival_id';
END IF; -
Excel 2013 connect to a cube, and Power View concatenate the column name by default
Hi Guys,
Currently, we met a problem with excel services to connect to a cube, when we develope a Excel 2013 Powerview report, the data model column name is concatenate into terrible name by default. e.g. Dim TimeDate Date, Dim TimeTime HierachyYear -Month.
But when start up the data model with Powerpivot, everything gone well. We knew that it can be manual update the name as workaround, but we need to do it every time we create a new powerview with the data model.
Is that any other solution we can do with?
Please help.
JohnnyHi,
As this question is more related to PowerView Report, I suggest you can create a new post in the PowerView forum, you will get more helpful information from there.
PowerView Forum:
https://social.technet.microsoft.com/Forums/en-US/home?forum=powerview
Best Regards
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jerry Guo
TechNet Community Support -
Concatenate 2 data fields and put values in single line
Hello,
I am pretty new to BI Publisher. I want to concatenate 2 data fields (Product and ProductType). These concatenated values then I want to put them on a single line.
eg.
the values should look like
ProductType1.Product1,ProductType2.Product2, ProductType3.Product3..........
Thanks.The XML is
- <ServiceAgreement>
<AccountId>1-abcde</AccountId>
<AgreementNumber>1-685</AgreementNumber>
<AgreementStartDate>07/08/2010 13:46:18</AgreementStartDate>
<AgreementStatus>Awaiting</AgreementStatus>
<ContactFirstName />
<ITIStreetAddress />
<ITIStreetNumber />
- <ListOfOrderEntry-Orders>
- <OrderEntry-Orders>
<ITIMoneyToCollect />
<OrderDate>07/08/2010 13:46:53</OrderDate>
<OrderNumber2>1-685579</OrderNumber2>
<OrderStatus>Pending</OrderStatus>
<OrderType>Sales Order</OrderType>
- <ListOfOrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Hollywood 18m</Product>
<ProductType />
<PromotionId>123456</PromotionId>
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName>Hollywood 18m</ProdPromName>
<Product>n TV</Product>
<ProductType>Root</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>HBO + nFilmHD</Product>
<ProductType />
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>HBO</Product>
<ProductType>Opcje dodatkowe</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>nFilmHD</Product>
<ProductType>Opcje dodatkowe</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>nbox HDTV</Product>
<ProductType>Dekoder</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Cinemax</Product>
<ProductType>Opcje dodatkowe</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Filmbox</Product>
<ProductType>Opcje dodatkowe</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Upust za zakup 3-ego pakietu</Product>
<ProductType>Upusty</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Pakiet Informacja i Rozrywka</Product>
<ProductType>Pakiety</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Opłata aktywacyjna za nbox HDTV</Product>
<ProductType />
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Pakiet Dzieci</Product>
<ProductType>Pakiety</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
- <OrderEntry-LineItems>
<OrderType2>Sales Order</OrderType2>
<ProdPromName />
<Product>Pakiet Sport i Motoryzacja</Product>
<ProductType>Pakiety</ProductType>
<PromotionId />
<ServiceId />
</OrderEntry-LineItems>
</ListOfOrderEntry-LineItems>
</OrderEntry-Orders>
</ListOfOrderEntry-Orders>
</ServiceAgreement>
</ListOfBipServiceAgreement>
As per the above XML I want to see
Pakiet Dzieci.Pakiety , Pakiet Sport i Motoryzac ja.Pakiety.....
Thanks -
Getting values from a table and concatenate them
Hi All,
I think somebody out there should be able to help me.
I have a list of contract numbers the user has to type in.
I've created a table where user can add as many rows as needed. Each row is a contract number.
Once completed, I have to concatenate all of the contract numbers, separated with commas, so that I can send them to a floating field within a text box.
It should look like this.
.....1234, 2345, 3456 and 5678 (assuming these four values were keyed in by the user in the table form)
Anybody can help me explaining how to concatenate the values and put them into the floating field?
Thanks in advance.
RafaelYou can concatinate them easily but getting them into a floating field on the same form will be an issue. The floating field can only be filled when th eform is rendered and data is placed on the form. Floating fields are not interactive...so after the data load they are turned into text....they are not even fields anymore.
-
How can i concatenate single quote to a field symbol
hi
i have a senario where i have to concatenate a single quote (') to the field symbol. it is simple but i' m not able to do that.
concatenate ''' <f> ''' into lv_f.
CONCATENATE lv_condition_temp lv_f INTO
lv_condition_temp
SEPARATED BY space.
this is the code which i used. could someone help me in solving this...
thanks & regards,
subha....hi
i tried using the following code
data : lv_text(10) type c.
concatenate ''' <f> ''' into lv_text.
it is giving me a spelling or incorrect comma error.
thanks & regards,
subhashini. -
SQL - How to CONCATENATE and TRANSLATE in the same argument
Hi,
I am trying to CONCATENATE 7 columns into 1 and then TRANSLATE the values. I have written the below SQL, but it is throwing me error as - "invalid number of arguments". Can someone help me with the query?
SQL
====
SELECT
A.ITEM as PROD_NO,
TRANSLATE(B.NON_DEL1 ||
B.NON_DEL2 ||
B.NON_DEL3 ||
B.NON_DEL4 ||
B.NON_DEL5 ||
B.NON_DEL6 ||
B.NON_DEL7),'YN','X ') SUPP_NON_CODE
FROM (SELECT * FROM ITEM_DATA WHERE ITEM_TYPE = 'PRODUCT') A
LEFT OUTER JOIN ITEM_DETAILS ITDET ON A.ITEM = B.ITEM
ORDER BY A.ITEM;
INPUT DATA
========
ITEM_DATA table
ITEM ITEM_TYPE
============
100002 PRODUCT
100004 PRODUCT
100005 PRODUCT
100006 PRODUCT
ITEM_DETAILS table
ITEM NON_DEL1 NON_DEL2 NON_DEL3 NON_DEL4 NON_DEL5 NON_DEL6 NON_DEL7
=====================================================
100002 N N N N N N N
100004 Y Y Y Y Y Y Y
100005 Y Y N Y N Y Y
100006 Y N N Y Y Y Y
OUTPUT EXPECTED
ITEM SUPP_NON_CODE
=================
100002
100004 XXXXXXX
100005 XX X XX
100006 X XXXX
Regards
Harsha
Edited by: user13025253 on Apr 23, 2010 1:53 AMRemove the bracket after B.NON_DELIVERY_IND7.
Urs -
How to concatenate the values in single row with images or colours
hi all,
i am apex 4.2,
i tried to execute a plsql query for the values concatenate two values into same column
example in my table
i am having teachers list one can teach two or three subjects
in table i am saving like
teacher_id teacher_name salary subjects
1 ram 5000 science,maths
2 gang 4000 maths,science,english
but my report should come like
teacher_id teacher_name salary subjects
1 ram 5000 science maths i have to highlighting these subjects with images or with different colors
2 gang 4000 maths english science
can any one help me please
thanks & regards
pavan
Edited by: Pavan on Apr 9, 2012 4:15 AM
Edited by: Pavan on Apr 9, 2012 4:22 AMFirst of all, i would split the subjects column.
If you for sure only need up to 3 subjects, you could make three columns subject1, subject2, subject3.
If you may have an indefinite number of subjects for each teacher, you might create a detail-table with the subjects for each teacher.
I also would create a list of values for the subjects, either based on static values or based on another table with the subjects allowed.
Now that the subject-names are fixed you could create a subject-image for each subject, named as the subject itself. Then you "construct" the image for each subject as
<img src="#APP_IMAGES##SUBJECT_NAME#.png"/> -
How to show two or more PDF in one PDF-Reader / Concatenate PDF-Files
Hi,
I want to show two or more PDF files in one PDF reader window or to concatenate two or mor PDF files to one file.
We use WD4A and ADS.
Have someone an idea to solve this without an external program?
Thx in advance
JürgenWe have done this successfully a few times using WDA - it wasn't easy - it took us 2 full weeks to figure it out, so i need to get full points for this one!
It's going to much easier to do this if you start a brand new WDA. If not, you'll have to re-do all your Context Node navigations within your methods.
The first thing you need to do is to define your Context properly:
You need a top level Node defined as 1:1 cardinality (as with all PDF development)
Next, you need another Container Node 1:n cardinality (this holds the collection of content nodes)
Finally, you have your PDF Content Node 1:n cardinality - This holds each instance of your PDF form
In our scenario, we are passed in a list of Project Numbers. We need to generate a PDF sheet for each project in the same PDF session.
pseudo code - i'm leaving out some of the unnessary details
Loop through the project number table.
ADD 1 TO v_cnt.
* navigate from <TOP> to <PDF_CONTAINER> via lead selection
lo_nd_pdf_container = lo_nd_top->get_child_node( name = wd_this->wdctx_pdf_container ).
* This is the Important Part - we check to see if there is an element where index = v_cnt
* If not, we create one where we can store the new set of data
* get element via lead selection
lo_el_pdf_container = lo_nd_pdf_container->get_element( index = v_cnt ).
IF lo_el_pdf_container IS INITIAL.
lo_el_pdf_container = lo_nd_pdf_container->create_element( ).
lo_nd_pdf_container->bind_element( new_item = lo_el_pdf_container
set_initial_elements = ' ' ).
ENDIF.
lo_nd_ideasheet_data = lo_el_pdf_container->get_child_node( 'IDEASHEET_DATA' ).
lo_el_ideasheet_data = lo_nd_ideasheet_data->get_element( index = 1 ).
* fill all the data then bind the structure
Select * from XXX into lt_XXX
where project_number = lt_project-project_number.
* Move Data to appropriate fields/tables
* Bind the info back to the element
lo_el_ideasheet_data->set_static_attributes( static_attributes =
ls_ideasheet_data ).
Endloop. -
How to concatenate multiple records into one
Hi everybody:
I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
Lan|Author
English|Ernest Hemingway
Spanish|Octavio Paz
Spanish|Mario Vargas Llosa
English|Sinclair Lewis
Spanish|Gabriel García Márquez
And I want to get this:
Author
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
RETURNS varchar(5000) AS
BEGIN
declare @retvalue varchar(5000)
set @retvalue=''
select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
return substring(@retvalue,1,len(@retvalue)-1)
END
ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
v_ret VARCHAR2(4000);
v_element VARCHAR2(4000);
v_cursor sys_refcursor;
BEGIN
OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
LOOP
FETCH v_cursor INTO v_elemento;
EXIT WHEN v_cursor%NOTFOUND;
IF v_ret IS NULL THEN
v_ret := v_element;
ELSE
v_ret := v_ret || ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
Exist some other way to do this?
Best Regards
JackTks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
I wil read about the other techniques than Hoek mention
Best Regards.
Jack -
Concatenate multiple row values into single column value
Hello,
Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
SELECT a.application_id, a.membership_number,
r.reason_text AS denial_reason,
a.appl_receipt_date AS application_receipt_date,
a.plan_request_1 AS application_plan_code,
a.adjudication_date AS application_denial_date
FROM application a, PLAN p, application_reason ar, reason r
WHERE a.plan_request_1 = p.plan_cd
AND a.application_id = ar.application_id
AND ar.reason_id = r.reason_id
AND a.adjudication_cd = 'D'
AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
AND p.plan_type_id = 12 and a.application_id = :appId
ORDER BY application_id
Any help is greatly appreciated.
Thanks,
-Christinefound the following
SELECT deptno,
LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
FROM (SELECT deptno,
ename,
ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr,
ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev
FROM emp)
GROUP BY deptno
CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
START WITH curr = 1;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php -
Concatenate multiple records into one single record
Hello everyone,
Can anyone guide me how to merge multiple records into one single record
like......... I am getting the data in the file like
aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
ffffff/gggg/hhhhhhhhhhhhhh
/123/4567/55555/99999999/kaoabfa/eee
fffff/kkkkkkkk/llllllllllllllllllllllll
when i use gui_upload I am getting the data into the internal table in the above format.
My main intension is to split the record at / to multiple lines and dowload it into another file.
What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.Yes, it should work.
In my example
Loop at itab.
concatenate i_text itab into i_text.
endloop.
You change that loop for the loop of your internal table with the file records
So if you have this three records
'aaaa/bbb/ccc'
'/dddd/efg'
'hijk/lmn'
i_text will look like this at the end
'aaaa/bbb/ccc/dddd/efghijk/lmn'
then in this part of the code
split i_text at '/' into table itab2.
itab2 will have the records looking like this
aaaa
bbb
ccc
dddd
efghijk
lmn' -
Is there a way to create a function that concatenates
Hello,
I constantly find myself needing to create a forumla tha concatenates employee's ID, last name, and first name. Is there a way to create a function in Crystal that will allow me to create a function that already has this concatenation in place? I am using Crystal XiR2.
Thanks,
ZHi Zack,
Custom function is a function that can be used in any report and it doesn't depend on database. We have to provide the values in order to claculate what we want and basing on the values provided it calculates accordingly. We cannot use global variables in custom functions and also evaluation time functions (like whileprintingrecords,whilereadingrecords). So I think it is not possible to get the strings concatenated without passing the values.
Alternatively you can go for a query using Add Command like this
select IDFirstNameLastName as value from table
Regards,
Raghavendra
Maybe you are looking for
-
How to update long text in symptoms/problems ?
Hi All, Can anybody help me regarding how to update the long text of a symptom/problem? Please help. Regards, Jeetu
-
Any Scenario with the Screenshots on PI 7.0
Dear Experts, I need any scenario eg., file to file with the screen shots on PI7.0 ie., 1) SLD configuration (product, swc, TS and BS) 2) IR and ID 3) Monitoring details Note : Above all i need with the screenshots on PI7.0 only Thanks in
-
IPod Touch 4th Gen iTunes Sync Freezing Issue
My iPod Touch 4th Generation freezes during the "Backing up" stage of sync. Nothing I have tried so far has resolved this issue and it's getting very annoying seeing as how I can't sync my iPod at all. I know it isn't just the iPod's fault, because i
-
Opening InDesign 2.0 files in CS2/CS3
Dear people who know, I tried to research this a bit but did not readily find an answer or pointers that worked, so forgive me if I've overlooked something. I used to have acess to InDesign 2.0 on which I created several layout. The media school wher
-
Dear Experts, I have many BW objects (like Infocubes, Infoobject catalogues, Infoobjects) for which no short and long texts are maintained in one language. Now, all these are in use in the production system. I have to edit the short and long texts fo