Hi everyone,
I hope someone can help me. I have a dynamic browser showing a dynamic query on a dynamic temp-table. Is there a way to assign a calculated value into a buffer value indirectly?
For example, say I have this code:
This works fine, showing the calculation of (points - bonus) in a column in my browser.
However, what I want to do is create custom calculations against any fields in my PlayerStatSeason table and store the calculation string in another table, so that I can display their results in my browser.
For example, say I have a table CustomCalc with a field CalcName = "PointsMinusBonus" and CalcString = "PlayerStatSeason.Points - PlayerStatSeason.Bonus" (i.e. the same calculation as above). I want my code to effectively be:
Is this possible in any way?
I hope someone can help me. I have a dynamic browser showing a dynamic query on a dynamic temp-table. Is there a way to assign a calculated value into a buffer value indirectly?
For example, say I have this code:
Code:
CREATE TEMP-TABLE httPlayerStatSeason.
httPlayerStatSeason:CREATE-LIKE(BUFFER PlayerStatSeason:HANDLE).
httPlayerStatSeason:ADD-NEW-FIELD("PointsMinusBonus","INT").
httPlayerStatSeason:TEMP-TABLE-PREPARE("PlayerStatSeason").
hDefaultBuffer = httPlayerStatSeason:DEFAULT-BUFFER-HANDLE.
FOR EACH PlayerStatSeason NO-LOCK:
hDefaultBuffer:BUFFER-CREATE.
hDefaultBuffer:BUFFER-COPY(BUFFER PlayerStatSeason:HANDLE).
hDefaultBuffer:BUFFER-FIELD("PointsMinusBonus"):BUFFER-VALUE = PlayerStatSeason.Points - PlayerStatSeason.Bonus.
END.
However, what I want to do is create custom calculations against any fields in my PlayerStatSeason table and store the calculation string in another table, so that I can display their results in my browser.
For example, say I have a table CustomCalc with a field CalcName = "PointsMinusBonus" and CalcString = "PlayerStatSeason.Points - PlayerStatSeason.Bonus" (i.e. the same calculation as above). I want my code to effectively be:
Code:
FOR EACH PlayerStatSeason NO-LOCK:
hDefaultBuffer:BUFFER-CREATE.
hDefaultBuffer:BUFFER-COPY(BUFFER PlayerStatSeason:HANDLE).
FIND CustomCalc WHERE CalcName = "PointsMinusBonus" NO-LOCK.
hDefaultBuffer:BUFFER-FIELD("PointsMinusBonus"):BUFFER-VALUE = CustomCalc.CalcString.
END.