Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dexterity - Dynamic field prompt?

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
I don't even know if this is possible - but it's worth a shot.

I'd like to have a dynamic field prompt. The window contains a field that could be a Price or a Percentage. This is control via a boolean checkbox that changes the linked format for the field (that part works).

What I would like to do is have the prompt for that field reflect what is being looked for, so when the checkbox is checked the prompt would display "Percent" and when unchecked "Price."

I haven't been able to find anything about using sanScript to modify the value of static text prompts - and indeed it throws errors when I try to reference it like a field '[Text] Price'.

I could use a local string field to control the text - making it read-only, setting the colors, and borders to look like a prompt - but I can't link it like a prompt.

Anybody have any thoughts?

Thanks.
 
You have two choices:

Old method: use a non editable local string field to pretend to be a prompt.

New method: Use the Field_SetStringProperty() command to change the FIELD_PROP_CAPTION property.

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Well - it looks like the new method doesn't work (unless I did something wrong).
Code:
if 'IsMarkup' then
	'(L) PriceMarkupFormat' = 15;
	'(L) PriceMarkup Label' = "Markup";
	Field_SetStringProperty('Item PriceMarkup', FIELD_PROP_CAPTION, "Markup");
else
	'(L) PriceMarkupFormat' = 9;
	'(L) PriceMarkup Label' = "Price";
	Field_SetStringProperty('Item PriceMarkup', FIELD_PROP_CAPTION, "Price");
end if;
That's the code I have on the IsMarkup change event. IsMarkup is a checkbox. The field 'Item PriceMarkup' has it's format linked to '(L) PriceMarkupFormat'. '(L) PriceMarkup Label' is a string field masquerading as a prompt. Though I do have an actual prompt linked to the 'Item PriceMarkup' field it does not change as the pretender does - and I have confirmed the function is returning a boolean true value.

Looks like I'll have to go with the pretender instead of an actual prompt.

Thanks for the suggestions anyway.
 
Hi Borvik

You need to use one or the other method.

For the Field_SetStringProperty to work you must have linked the prompt from the field to a static text.

Make sure that the prompt is showing as the linked prompt when you look at the field properties.

This method does work. I have used it before.

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
The selected prompt in the screenshot IS the prompt to the field in question. It is a "static text" as can be seen from the screenshot.

ECI_Example.png


So I'm not sure what is going on - maybe I'm doing it wrong, but it isn't changing.
 
Hi Borvik

I will be honest as you are using a price (normally currency datatype) and a percent (normally integer datatype), I would have two overlaid fields with two static text linked prompts and use hide and show rather than messing with formats and changing prompts.

You will find this works much better and is easier.

David

PS: Maybe you should unlink the prompt (drag from field to blank area) and then link it again.

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Maybe - but an integer doesn't store decimal places and it is going to be a markup percentage so that decimal place may come in handy - hence the currency type (though I notice the percentage stored on the Item Price List Maintenace screen is a currency as well).

Plus using one field and a boolean saves db space over two numeric fields (especially when talking about a LARGE number of items in the database).

I don't mind using the faux prompt method, I was just curious on whether I could do a real prompt as that would be preferable.

Thanks for the discussion and trying though.
 
Hi Borvik

All other percentages in GP are stored using integers. Usually with the 5%2 format. So when you enter the percentage 50.00% on the screen, the actual value is 5000.

Then when you use this value in a formula, you need to divide by an additional 100. So New Amount = Old Amount * (percentage / 10000).

This is a GP standard practice. Have a look at the Mark Percentage value in SOP.


David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top