JDP
标量值函数数据库-->可编程性-->函数-->标量值函数
创建标量值函数
比如要将付款单里面的付款账户明细表之付款方式增加到报表
第一步、在数据库为付款方式创建标量值函数
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[BuyAccoutPaytype](@f_ref varchar(100))
returns varchar(8000)
as
begin
declare @str varchar(8000)
set @str=''
select @str=@str+','+Paytype from tblPayAccountDet
where tblPayAccountDet.f_ref=@f_ref
if(len(@str)>0)
begin
set @str=right(@str,len(@str)-1)
end
return(@str)
End
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[SalesAccoutSettleType](@f_ref varchar(100))
returns varchar(8000)
as
begin
declare @str varchar(8000)
set @str=''
select @str=@str+','+SettleType from tblReceiveAccountDet
where tblReceiveAccountDet.f_ref=@f_ref
if(len(@str)>0)
begin
set @str=right(@str,len(@str)-1)
end
return(@str)
End
第二步、JDP平台将此标量值函数值添加到相关报表
(select dbo.BuyAccoutDetail(id) from tblPay a where a.id=tblPay.id)
(select dbo.SalesAccoutSettleType(id) from tblSaleReceive a where a.id=tblSaleReceive.id )