HardCode Field

kolaboykolaboy Member Posts: 446
Hi Experts,
Can anyone tell me how to hardcode a field in the customer table called Global dimension code 1 to 300. I tried Writing this in the onaftergetrecord trigger but it give me an error.
This hardcode is to be done on a report with customer as the dataitem.
"Global Dimension 1 Code" := 400;
The Error is:
Type conversion is not Possible because one of the Operators contains an invalid type Code := Integer

Any suggestion to slove this please.
Thanks

Comments

  • SavatageSavatage Member Posts: 7,142
    edited 2007-07-30
    The Error is:
    Type conversion is not Possible because one of the Operators contains an invalid type Code := Integer

    instead of 400 like a number - try '400' with the quotes.

    *assuming "400" is an actual dimension code.
  • kolaboykolaboy Member Posts: 446
    I have just tried this but it not working. I try filtering with a field which is not having 400 as dimension value and it has taken it.
    I expect to run this report with only Customers with Global Dimension 1 code value to be 400 even without filtering.

    The error has stopped but i have not achieve what i want.

    What might be the problem?
    Thanks.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    It is not clear what you want to achieve. Do you want the global dimension 1 value "400" to be assigned to new customers, or do you want to filter all customers in a report (all customers with global dimension 1 value = "400")?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • SavatageSavatage Member Posts: 7,142
    edited 2007-07-30
    If the report is only for Customers with Dimension Code 1 = 400

    why not View->Properties of the dataitem you are using then set the property
    DataItemTableView : WHERE(Global Dimension 1 Code=FILTER(400))

    :?:
  • kolaboykolaboy Member Posts: 446
    Savatge, Your suggestion seems correct to me, i will try it and give you feedback later.
    Thanks.
  • kolaboykolaboy Member Posts: 446
    Hi experts,
    f the report is only for Customers with Dimension Code 1 = 400

    why not View->Properties of the dataitem you are using then set the property
    DataItemTableView : WHERE(Global Dimension 1 Code=FILTER(400))

    Thanks savatge, this works. Can this be hardcoded? I want it hardcoded, because i will be filtering receiveble accounts. As it is right now, if i set another filter it does not show anything.
    my aim is to have the report filter where Global Dimension Code 1 = '400'
    and Receivable account = '14620'

    Can we have it hardcode? any idea.
    Thanks.
  • DenSterDenSter Member Posts: 8,304
    If you set it in a property, then it IS hardcoded.
  • SavatageSavatage Member Posts: 7,142
    also use the drilldown assist to add Receivable account = '14620' to the dataitemtableview.

    Also what do you mean it does not show anything if you set another filter.

    First off setting that property to 400 will only show customers with 400 as their GD1C. now if you have (for example) 100 customers with 400 then only the 100 will show but you can still filter on those 100 using other fields.

    Like which customers have the same contact or have the same salesperson or have the same terms or have a name that starts with W*....etc etc etc. once you set that property to 400 you can't use that Global Dimension 1 for any other option 100, 200, 300 , 500. it's SET @ 400!

    I don't know what the Receiveable account is but I guess it would look something like this:

    WHERE(Global Dimension 1 Code=CONST(400),Customer Posting Group=CONST(14620))
  • kolaboykolaboy Member Posts: 446
    savatage,
    also use the drilldown assist to add Receivable account = '14620' to the dataitemtableview.

    Also what do you mean it does not show anything if you set another filter.

    First off setting that property to 400 will only show customers with 400 as their GD1C. now if you have (for example) 100 customers with 400 then only the 100 will show but you can still filter on those 100 using other fields.

    Like which customers have the same contact or have the same salesperson or have the same terms or have a name that starts with W*....etc etc etc. once you set that property to 400 you can't use that Global Dimension 1 for any other option 100, 200, 300 , 500. it's SET @ 400!

    I don't know what the Receiveable account is but I guess it would look something like this:

    WHERE(Global Dimension 1 Code=CONST(400),Customer Posting Group=CONST(14620))

    This is exactly what i want. I want the report to filter by
    Global Dimension 1 Code=CONST(400) and also
    Customer Posting Group=CONST(14620))

    This should display all customer that have satisfy the above. i want it to filter by GD1C and then filter among GD1C by Customer Posting Group.

    I have set the dataitemtableview to the above two conditions but when i run the report, It becomes blank. i.e report generated completed(0 pages).
    i don't know what the problem is but these are the two conditions that should give me the results

    Sorry, i am very new in Navision, so when i say hardcode i though i can be done using the C/AL code only. Now i have understood and have learnt.

    Any suggestion again please!!!
    Thanks.
  • SavatageSavatage Member Posts: 7,142
    DateItemTableView:WHERE(Global Dimension 1 Code=CONST(400),Customer Posting Group=CONST(14620))

    this should work

    1)change CONST to FILTER to seeif it makes a difference
    2)are you sure you have customers that actually satisfy these conditions
    3)are you setting some other filters somewhere with code?
  • DenSterDenSter Member Posts: 8,304
    kolaboy wrote:
    when i say hardcode i though i can be done using the C/AL code only
    Right I see your confusion. Setting properties at design time is included in 'hard coded'. Anything that you do at design time (setting properties, adding controls, writing C/AL code) is hard coded.
Sign In or Register to comment.