cancel
Showing results for 
Search instead for 
Did you mean: 

Formatted Search and UDF

Former Member
0 Kudos

Hi all,

I have an issue with a formatted search.

My intention is to update the field RDR1.vatgroup with a value set in a UDF on the sales order.

I have not been able to make it work, and If someone have a quick help idea it would be nice.

I have defined a userdefined field called u_avgcode. This is linked to some valied values for field like U1,U2,U3. The structure is 1=U1 and 2=U2 and so on.

<u>When I change a value here I would like to update the whole salesorder (all lines) with this value replacing the Tax code (RDR1.Vatgroup).</u>

The formatted search is like this on the RDR1.vatgroup:

if (Select $[$ORDR.U_avgcode]) = 'U1'

begin

declare @newcode as nvarchar(25)

set @newcode = U1

select @newcode

end

I have set 'Auto refresh' when the UDF field changes.

I can't make this work properly, any ideas..

I have also tried if (Select $[ORDR.U_avgcode]) = 'U1' with no luck.

regards

me

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Vidar

AFAIK, Formatted Search can be used in 2 ways:

1. To query values stored in DB. Is your Sales Order

already saved when the query is performed?

2. Also, one can query item/field values of the same

form using the SELECT $[$14.1.0] -format.

(Check F1 help or search this forum on this topic)

However, the base form and the form that contains

UDFs are separate forms (Sales Order = 139 and UDFs

of Sales Order = -139 ). Therefore your (cross-form) FS doesn't work.

HTH

Juha

Former Member
0 Kudos

Thanx for making the FS more understanding Juha,

1. My sales order is not saved, so there is no data in the DB at the moment I would replace the taxcode.

2. I know about this, but as you mentioned the forms are separated and the it would be a problem referencing to the data stored.

So my solution would then be?

1. Create a SDK taking hight for the UDF and replace the data in the form?

or 2. use a field in the existing form(139) and make this my new 'UDF'?

or last 3. Have a UDF on the order lines and the make this the controller.?

regards

me

Former Member
0 Kudos

Regarding your options:

1. You can do this with UI API, but creating an add-on

just for this would be an overkill. Would it be possible

to motivate the the users to do it manually?

2. There is not much choice, because (AFAIK) the

source&object items must both be visible. If you can

steal 'Customer ref no' then go for it.

3. I haven't tried it but I think that you can look up

values in items on Sales Order header or values in the

same Sales Order row. Maybe you can not look up values

in other rows?

HTH

Juha

Former Member
0 Kudos

Thanx for input Juha.

I have made a solve to the problem, and it works fine now.

My FS is like:

declare @newtaxcode as nvarchar(2)

if (Select $[ORDR.U_avgkode]) = 'U0'

begin

set @newtaxcode = 'U0'

select @newtaxcode

end

I set this FS on my taxcode, and refered to my UDF when it changed. Works fine, but the screen is a bit flashy and "slow" when updating 50 order lines in a sales order.

I am now able to update many lines in a matrix with a single select from a UDF.

<u>Thanx to Ibai too, for helping me on track.</u>

One issue that also was a key element is to refer to the defined values for the UDF.

I had set like this:

code description

1 U0

2 U1

3 U2

I changed this too

code description

U0 U0

U1 U1

U2 U2

regards

me

Answers (0)